Skip to content

Commit

Permalink
tiny cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
imikushin committed Aug 22, 2024
1 parent 3e9450f commit 2dd39e9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/capped_hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ where

/// Removes a key from the map, returning the value at the key if the key was previously in the map.
pub fn remove(&mut self, k: &K) -> Option<V> {
let v = self.inner.remove(k)?;

self.last_items
.iter()
.position(|key| key == k)
.and_then(|pos| self.last_items.remove(pos));

Some(v)
self.inner.remove(k)
}

/// Returns a reference to the value corresponding to the key.
Expand Down

0 comments on commit 2dd39e9

Please sign in to comment.