@@ -642,7 +642,7 @@ impl<T> HeaderMap<T> {
642642 assert ! ( cap <= MAX_SIZE , "header map reserve over max capacity" ) ;
643643 assert ! ( cap != 0 , "header map reserve overflowed" ) ;
644644
645- if self . entries . len ( ) == 0 {
645+ if self . entries . is_empty ( ) {
646646 self . mask = cap as Size - 1 ;
647647 self . indices = vec ! [ Pos :: none( ) ; cap] . into_boxed_slice ( ) ;
648648 self . entries = Vec :: with_capacity ( usable_capacity ( cap) ) ;
@@ -1082,22 +1082,22 @@ impl<T> HeaderMap<T> {
10821082 danger,
10831083 Entry :: Vacant ( VacantEntry {
10841084 map: self ,
1085- hash: hash ,
1085+ hash,
10861086 key: key. into( ) ,
1087- probe: probe ,
1088- danger: danger ,
1087+ probe,
1088+ danger,
10891089 } ) ,
10901090 Entry :: Occupied ( OccupiedEntry {
10911091 map: self ,
10921092 index: pos,
1093- probe: probe ,
1093+ probe,
10941094 } ) ,
10951095 Entry :: Vacant ( VacantEntry {
10961096 map: self ,
1097- hash: hash ,
1097+ hash,
10981098 key: key. into( ) ,
1099- probe: probe ,
1100- danger: danger ,
1099+ probe,
1100+ danger,
11011101 } )
11021102 )
11031103 }
@@ -1201,7 +1201,7 @@ impl<T> HeaderMap<T> {
12011201
12021202 ValueDrain {
12031203 first : Some ( old) ,
1204- next : next ,
1204+ next,
12051205 lt : PhantomData ,
12061206 }
12071207 }
@@ -1407,7 +1407,7 @@ impl<T> HeaderMap<T> {
14071407
14081408 // backward shift deletion in self.indices
14091409 // after probe, shift all non-ideally placed indices backward
1410- if self . entries . len ( ) > 0 {
1410+ if ! self . entries . is_empty ( ) {
14111411 let mut last_probe = probe;
14121412 let mut probe = probe + 1 ;
14131413
@@ -1454,9 +1454,9 @@ impl<T> HeaderMap<T> {
14541454 assert ! ( self . entries. len( ) < MAX_SIZE , "header map at capacity" ) ;
14551455
14561456 self . entries . push ( Bucket {
1457- hash : hash ,
1458- key : key ,
1459- value : value ,
1457+ hash,
1458+ key,
1459+ value,
14601460 links : None ,
14611461 } ) ;
14621462 }
@@ -1851,7 +1851,7 @@ impl<'a, K, V, T> TryFrom<&'a HashMap<K, V>> for HeaderMap<T>
18511851 type Error = Error ;
18521852
18531853 fn try_from ( c : & ' a HashMap < K , V > ) -> Result < Self , Self :: Error > {
1854- c. into_iter ( )
1854+ c. iter ( )
18551855 . map ( |( k, v) | -> crate :: Result < ( HeaderName , T ) > {
18561856 let name = TryFrom :: try_from ( k) . map_err ( Into :: into) ?;
18571857 let value = TryFrom :: try_from ( v) . map_err ( Into :: into) ?;
@@ -2038,7 +2038,7 @@ fn append_value<T>(
20382038 Some ( links) => {
20392039 let idx = extra. len ( ) ;
20402040 extra. push ( ExtraValue {
2041- value : value ,
2041+ value,
20422042 prev : Link :: Extra ( links. tail ) ,
20432043 next : Link :: Entry ( entry_idx) ,
20442044 } ) ;
@@ -2050,7 +2050,7 @@ fn append_value<T>(
20502050 None => {
20512051 let idx = extra. len ( ) ;
20522052 extra. push ( ExtraValue {
2053- value : value ,
2053+ value,
20542054 prev : Link :: Entry ( entry_idx) ,
20552055 next : Link :: Entry ( entry_idx) ,
20562056 } ) ;
@@ -2422,7 +2422,7 @@ impl<'a, T> VacantEntry<'a, T> {
24222422 // Ensure that there is space in the map
24232423 let index =
24242424 self . map
2425- . insert_phase_two ( self . key , value. into ( ) , self . hash , self . probe , self . danger ) ;
2425+ . insert_phase_two ( self . key , value, self . hash , self . probe , self . danger ) ;
24262426
24272427 & mut self . map . entries [ index] . value
24282428 }
@@ -2449,11 +2449,11 @@ impl<'a, T> VacantEntry<'a, T> {
24492449 // Ensure that there is space in the map
24502450 let index =
24512451 self . map
2452- . insert_phase_two ( self . key , value. into ( ) , self . hash , self . probe , self . danger ) ;
2452+ . insert_phase_two ( self . key , value, self . hash , self . probe , self . danger ) ;
24532453
24542454 OccupiedEntry {
24552455 map : self . map ,
2456- index : index ,
2456+ index,
24572457 probe : self . probe ,
24582458 }
24592459 }
@@ -2863,7 +2863,7 @@ impl<'a, T> OccupiedEntry<'a, T> {
28632863 /// assert_eq!("earth", map["host"]);
28642864 /// ```
28652865 pub fn insert ( & mut self , value : T ) -> T {
2866- self . map . insert_occupied ( self . index , value. into ( ) )
2866+ self . map . insert_occupied ( self . index , value)
28672867 }
28682868
28692869 /// Sets the value of the entry.
@@ -2889,7 +2889,7 @@ impl<'a, T> OccupiedEntry<'a, T> {
28892889 /// assert_eq!("earth", map["host"]);
28902890 /// ```
28912891 pub fn insert_mult ( & mut self , value : T ) -> ValueDrain < ' _ , T > {
2892- self . map . insert_occupied_mult ( self . index , value. into ( ) )
2892+ self . map . insert_occupied_mult ( self . index , value)
28932893 }
28942894
28952895 /// Insert the value into the entry.
@@ -2916,7 +2916,7 @@ impl<'a, T> OccupiedEntry<'a, T> {
29162916 pub fn append ( & mut self , value : T ) {
29172917 let idx = self . index ;
29182918 let entry = & mut self . map . entries [ idx] ;
2919- append_value ( idx, entry, & mut self . map . extra_values , value. into ( ) ) ;
2919+ append_value ( idx, entry, & mut self . map . extra_values , value) ;
29202920 }
29212921
29222922 /// Remove the entry from the map.
@@ -3095,12 +3095,12 @@ impl<'a, T> Iterator for ValueDrain<'a, T> {
30953095 // Exactly 1
30963096 ( & Some ( _) , & None ) => ( 1 , Some ( 1 ) ) ,
30973097 // 1 + extras
3098- ( & Some ( _) , & Some ( ref extras) ) => {
3098+ ( & Some ( _) , Some ( extras) ) => {
30993099 let ( l, u) = extras. size_hint ( ) ;
31003100 ( l + 1 , u. map ( |u| u + 1 ) )
31013101 } ,
31023102 // Extras only
3103- ( & None , & Some ( ref extras) ) => extras. size_hint ( ) ,
3103+ ( & None , Some ( extras) ) => extras. size_hint ( ) ,
31043104 // No more
31053105 ( & None , & None ) => ( 0 , Some ( 0 ) ) ,
31063106 }
@@ -3111,7 +3111,7 @@ impl<'a, T> FusedIterator for ValueDrain<'a, T> {}
31113111
31123112impl < ' a , T > Drop for ValueDrain < ' a , T > {
31133113 fn drop ( & mut self ) {
3114- while let Some ( _ ) = self . next ( ) { }
3114+ for _ in self . by_ref ( ) { }
31153115 }
31163116}
31173117
@@ -3154,7 +3154,7 @@ impl Pos {
31543154 debug_assert ! ( index < MAX_SIZE ) ;
31553155 Pos {
31563156 index : index as Size ,
3157- hash : hash ,
3157+ hash,
31583158 }
31593159 }
31603160
@@ -3418,7 +3418,7 @@ mod as_header_name {
34183418 }
34193419
34203420 fn as_str ( & self ) -> & str {
3421- <HeaderName >:: as_str ( * self )
3421+ <HeaderName >:: as_str ( self )
34223422 }
34233423 }
34243424
@@ -3472,7 +3472,7 @@ mod as_header_name {
34723472 }
34733473
34743474 fn as_str ( & self ) -> & str {
3475- * self
3475+ self
34763476 }
34773477 }
34783478
0 commit comments