diff --git a/src/entity/gateway/inmemory.rs b/src/entity/gateway/inmemory.rs index 560d683..ba6f665 100644 --- a/src/entity/gateway/inmemory.rs +++ b/src/entity/gateway/inmemory.rs @@ -21,8 +21,8 @@ where K: Ord + Copy, V: Clone, { - if !working_table.contains_key(&key) { - working_table.insert(key, original_table.get(&key)?.clone()); + if let std::collections::btree_map::Entry::Vacant(e) = working_table.entry(key) { + e.insert(original_table.get(&key)?.clone()); } Some(())