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-07-24 07:48:04 +0000
committerbors <bors@rust-lang.org>2023-07-24 07:48:04 +0000
commit155a5c2862c2939aa8464456ca9f358fbb213005 (patch)
tree8dbb005d85f43380be22df2c80bd1337bf1f75d5 /compiler/rustc_data_structures/src
parentbccefd280755e52b60d721bb6e5ff2556180a57b (diff)
parentaf2b370100cdc1767772af738a3259875bba38f3 (diff)
downloadrust-155a5c2862c2939aa8464456ca9f358fbb213005.tar.gz
rust-155a5c2862c2939aa8464456ca9f358fbb213005.zip
Auto merge of #113978 - matthiaskrgr:clippy_072023_style, r=fee1-dead
couple of clippy::style changes

    comparison_to_empty
    iter_nth_zero
    for_kv_map
    manual_next_back
    redundant_pattern

    get_first
    single_char_add_str
    unnecessary_mut_passed
    manual_map
    manual_is_ascii_check
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/sso/map.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs
index 99581ed2375..04e359a5470 100644
--- a/compiler/rustc_data_structures/src/sso/map.rs
+++ b/compiler/rustc_data_structures/src/sso/map.rs
@@ -268,11 +268,7 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
     pub fn remove_entry(&mut self, key: &K) -> Option<(K, V)> {
         match self {
             SsoHashMap::Array(array) => {
-                if let Some(index) = array.iter().position(|(k, _v)| k == key) {
-                    Some(array.swap_remove(index))
-                } else {
-                    None
-                }
+                array.iter().position(|(k, _v)| k == key).map(|index| array.swap_remove(index))
             }
             SsoHashMap::Map(map) => map.remove_entry(key),
         }