We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1145d5a commit b7e07c7Copy full SHA for b7e07c7
1 file changed
src/state.rs
@@ -56,8 +56,8 @@ impl HandleCache {
56
/// Insert a handle, evicting the oldest entry if at capacity.
57
pub(crate) fn insert(&mut self, key: String, value: cosmic::widget::image::Handle) {
58
// If already present just update the value in place.
59
- if self.map.contains_key(&key) {
60
- self.map.insert(key, value);
+ if let std::collections::hash_map::Entry::Occupied(mut e) = self.map.entry(key.clone()) {
+ e.insert(value);
61
return;
62
}
63
// Evict oldest entries until there is room.
0 commit comments