@@ -257,11 +257,7 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
257
257
pub fn remove ( & mut self , key : & K ) -> Option < V > {
258
258
match self {
259
259
SsoHashMap :: Array ( array) => {
260
- if let Some ( index) = array. iter ( ) . position ( |( k, _v) | k == key) {
261
- Some ( array. swap_remove ( index) . 1 )
262
- } else {
263
- None
264
- }
260
+ array. iter ( ) . position ( |( k, _v) | k == key) . map ( |index| array. swap_remove ( index) . 1 )
265
261
}
266
262
SsoHashMap :: Map ( map) => map. remove ( key) ,
267
263
}
@@ -272,11 +268,7 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
272
268
pub fn remove_entry ( & mut self , key : & K ) -> Option < ( K , V ) > {
273
269
match self {
274
270
SsoHashMap :: Array ( array) => {
275
- if let Some ( index) = array. iter ( ) . position ( |( k, _v) | k == key) {
276
- Some ( array. swap_remove ( index) )
277
- } else {
278
- None
279
- }
271
+ array. iter ( ) . position ( |( k, _v) | k == key) . map ( |index| array. swap_remove ( index) )
280
272
}
281
273
SsoHashMap :: Map ( map) => map. remove_entry ( key) ,
282
274
}
@@ -423,14 +415,14 @@ impl<K, V> IntoIterator for SsoHashMap<K, V> {
423
415
424
416
/// adapts Item of array reference iterator to Item of hashmap reference iterator.
425
417
#[ inline( always) ]
426
- fn adapt_array_ref_it < K , V > ( pair : & ' a ( K , V ) ) -> ( & ' a K , & ' a V ) {
418
+ fn adapt_array_ref_it < K , V > ( pair : & ( K , V ) ) -> ( & K , & V ) {
427
419
let ( a, b) = pair;
428
420
( a, b)
429
421
}
430
422
431
423
/// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator.
432
424
#[ inline( always) ]
433
- fn adapt_array_mut_it < K , V > ( pair : & ' a mut ( K , V ) ) -> ( & ' a K , & ' a mut V ) {
425
+ fn adapt_array_mut_it < K , V > ( pair : & mut ( K , V ) ) -> ( & K , & mut V ) {
434
426
let ( a, b) = pair;
435
427
( a, b)
436
428
}
0 commit comments