From af2b370100cdc1767772af738a3259875bba38f3 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Sun, 23 Jul 2023 13:11:20 +0200 Subject: more clippy::style fixes: get_first single_char_add_str unnecessary_mut_passed manual_map manual_is_ascii_check --- compiler/rustc_data_structures/src/sso/map.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'compiler/rustc_data_structures/src') 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 SsoHashMap { 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), } -- cgit 1.4.1-3-g733a5