about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-17 07:25:01 +0000
committerbors <bors@rust-lang.org>2023-04-17 07:25:01 +0000
commitbdb32bd4bbcabb0d32a04a0b45e6a8ceaa5e54d6 (patch)
tree6fb7bfe07cb65a11a5b9ab3334847b2e511fb982 /compiler/rustc_data_structures/src
parent53ac4f8e2fc15e49ef3a04f98622a9b9db755fd4 (diff)
parent35e63890bdd1b25298862cff59bce2a01728279b (diff)
downloadrust-bdb32bd4bbcabb0d32a04a0b45e6a8ceaa5e54d6.tar.gz
rust-bdb32bd4bbcabb0d32a04a0b45e6a8ceaa5e54d6.zip
Auto merge of #110440 - matthiaskrgr:rollup-eit19vi, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110038 (Erase regions when confirming transmutability candidate)
 - #110341 (rustdoc: stop passing a title to `replaceState` second argument)
 - #110388 (Add a message for if an overflow occurs in `core::intrinsics::is_nonoverlapping`.)
 - #110404 (fix clippy::toplevel_ref_arg and ::manual_map)
 - #110421 (Spelling librustdoc)
 - #110423 (Spelling srcdoc)
 - #110433 (Windows: map a few more error codes to ErrorKind)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/sso/map.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs
index 89b8c852649..99581ed2375 100644
--- a/compiler/rustc_data_structures/src/sso/map.rs
+++ b/compiler/rustc_data_structures/src/sso/map.rs
@@ -256,12 +256,9 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
     pub fn remove(&mut self, key: &K) -> Option<V> {
         match self {
             SsoHashMap::Array(array) => {
-                if let Some(index) = array.iter().position(|(k, _v)| k == key) {
-                    Some(array.swap_remove(index).1)
-                } else {
-                    None
-                }
+                array.iter().position(|(k, _v)| k == key).map(|index| array.swap_remove(index).1)
             }
+
             SsoHashMap::Map(map) => map.remove(key),
         }
     }