Skip to content

Commit

Permalink
Rollup merge of rust-lang#133257 - GuillaumeGomez:unordmap-clear, r=lcnr
Browse files Browse the repository at this point in the history
Add `UnordMap::clear` method

I need it for something I'm working on and I was surprised to see this method was not implemented.
  • Loading branch information
matthiaskrgr authored Nov 20, 2024
2 parents 1099bc8 + 186e282 commit 71d07dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_data_structures/src/unord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ impl<K: Eq + Hash, V> UnordMap<K, V> {
.into_iter()
.map(|(_, v)| v)
}

#[inline]
pub fn clear(&mut self) {
self.inner.clear()
}
}

impl<K, Q: ?Sized, V> Index<&Q> for UnordMap<K, V>
Expand Down

0 comments on commit 71d07dd

Please sign in to comment.