Skip to content

Commit

Permalink
Use plain clear instead of clear_no_drop
Browse files Browse the repository at this point in the history
It was an over-optimization to use `clear_no_drop`, which hurts the
possibility of using griddle as an alternate table implementation.
  • Loading branch information
cuviper committed Jul 2, 2020
1 parent e5f0a23 commit a7c83bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/map/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ impl<K, V> IndexMapCore<K, V> {
}

pub(crate) fn clear(&mut self) {
self.indices.clear_no_drop();
self.indices.clear();
self.entries.clear();
}

pub(crate) fn drain(&mut self, range: RangeFull) -> Drain<Bucket<K, V>> {
self.indices.clear_no_drop();
self.indices.clear();
self.entries.drain(range)
}

Expand Down Expand Up @@ -217,7 +217,7 @@ impl<K, V> IndexMapCore<K, V> {
}

fn rebuild_hash_table(&mut self) {
self.indices.clear_no_drop();
self.indices.clear();
debug_assert!(self.indices.capacity() >= self.entries.len());
for (i, entry) in enumerate(&self.entries) {
// We should never have to reallocate, so there's no need for a real hasher.
Expand Down

0 comments on commit a7c83bc

Please sign in to comment.