about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-20 20:10:15 +0100
committerGitHub <noreply@github.com>2024-11-20 20:10:15 +0100
commit71d07dd0308953817757492628b159ebde17e89b (patch)
treef4ead737ffe111db657233d59e4e877ac34ef548
parent1099bc8e735430d860c7dc410024108f78d4c28b (diff)
parent186e282a43f384d456579ab50c5d6a48fd5cca1b (diff)
downloadrust-71d07dd0308953817757492628b159ebde17e89b.tar.gz
rust-71d07dd0308953817757492628b159ebde17e89b.zip
Rollup merge of #133257 - GuillaumeGomez:unordmap-clear, r=lcnr
Add `UnordMap::clear` method

I need it for something I'm working on and I was surprised to see this method was not implemented.
-rw-r--r--compiler/rustc_data_structures/src/unord.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/unord.rs b/compiler/rustc_data_structures/src/unord.rs
index bafb16a8b5e..34895d3efe6 100644
--- a/compiler/rustc_data_structures/src/unord.rs
+++ b/compiler/rustc_data_structures/src/unord.rs
@@ -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>