@@ -257,11 +257,7 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
257257 pub fn remove ( & mut self , key : & K ) -> Option < V > {
258258 match self {
259259 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 )
265261 }
266262 SsoHashMap :: Map ( map) => map. remove ( key) ,
267263 }
@@ -272,11 +268,7 @@ impl<K: Eq + Hash, V> SsoHashMap<K, V> {
272268 pub fn remove_entry ( & mut self , key : & K ) -> Option < ( K , V ) > {
273269 match self {
274270 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) )
280272 }
281273 SsoHashMap :: Map ( map) => map. remove_entry ( key) ,
282274 }
@@ -423,14 +415,14 @@ impl<K, V> IntoIterator for SsoHashMap<K, V> {
423415
424416/// adapts Item of array reference iterator to Item of hashmap reference iterator.
425417#[ 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 ) {
427419 let ( a, b) = pair;
428420 ( a, b)
429421}
430422
431423/// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator.
432424#[ 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 ) {
434426 let ( a, b) = pair;
435427 ( a, b)
436428}
0 commit comments