fix clippy::toplevel_ref_arg and ::manual_map
This commit is contained in:
parent
e6e956dade
commit
543f8bc38c
12 changed files with 42 additions and 70 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue