@@ -563,12 +563,8 @@ impl<K: Hash + Eq, V, S: BuildHasher> LinkedHashMap<K, V, S> {
563
563
/// assert_eq!(&'b', keys.next().unwrap());
564
564
/// assert_eq!(None, keys.next());
565
565
/// ```
566
- #[ cfg_attr( feature = "clippy" , allow( needless_lifetimes) ) ] // false positive
567
- pub fn keys < ' a > ( & ' a self ) -> Keys < ' a , K , V > {
568
- fn first < A , B > ( ( a, _) : ( A , B ) ) -> A { a }
569
- let first: fn ( ( & ' a K , & ' a V ) ) -> & ' a K = first; // coerce to fn ptr
570
-
571
- Keys { inner : self . iter ( ) . map ( first) }
566
+ pub fn keys ( & self ) -> Keys < K , V > {
567
+ Keys { inner : self . iter ( ) }
572
568
}
573
569
574
570
/// Returns a double-ended iterator visiting all values in order of insertion.
@@ -588,12 +584,8 @@ impl<K: Hash + Eq, V, S: BuildHasher> LinkedHashMap<K, V, S> {
588
584
/// assert_eq!(&20, values.next().unwrap());
589
585
/// assert_eq!(None, values.next());
590
586
/// ```
591
- #[ cfg_attr( feature = "clippy" , allow( needless_lifetimes) ) ] // false positive
592
- pub fn values < ' a > ( & ' a self ) -> Values < ' a , K , V > {
593
- fn second < A , B > ( ( _, b) : ( A , B ) ) -> B { b }
594
- let second: fn ( ( & ' a K , & ' a V ) ) -> & ' a V = second; // coerce to fn ptr
595
-
596
- Values { inner : self . iter ( ) . map ( second) }
587
+ pub fn values ( & self ) -> Values < K , V > {
588
+ Values { inner : self . iter ( ) }
597
589
}
598
590
}
599
591
@@ -950,8 +942,7 @@ impl<K, V> Drop for IntoIter<K, V> {
950
942
951
943
/// An insertion-order iterator over a `LinkedHashMap`'s keys.
952
944
pub struct Keys < ' a , K : ' a , V : ' a > {
953
- #[ cfg_attr( feature = "clippy" , allow( type_complexity) ) ]
954
- inner : iter:: Map < Iter < ' a , K , V > , fn ( ( & ' a K , & ' a V ) ) -> & ' a K >
945
+ inner : Iter < ' a , K , V > ,
955
946
}
956
947
957
948
impl < ' a , K , V > Clone for Keys < ' a , K , V > {
@@ -961,12 +952,12 @@ impl<'a, K, V> Clone for Keys<'a, K, V> {
961
952
impl < ' a , K , V > Iterator for Keys < ' a , K , V > {
962
953
type Item = & ' a K ;
963
954
964
- #[ inline] fn next ( & mut self ) -> Option < ( & ' a K ) > { self . inner . next ( ) }
955
+ #[ inline] fn next ( & mut self ) -> Option < & ' a K > { self . inner . next ( ) . map ( |e| e . 0 ) }
965
956
#[ inline] fn size_hint ( & self ) -> ( usize , Option < usize > ) { self . inner . size_hint ( ) }
966
957
}
967
958
968
959
impl < ' a , K , V > DoubleEndedIterator for Keys < ' a , K , V > {
969
- #[ inline] fn next_back ( & mut self ) -> Option < ( & ' a K ) > { self . inner . next_back ( ) }
960
+ #[ inline] fn next_back ( & mut self ) -> Option < & ' a K > { self . inner . next_back ( ) . map ( |e| e . 0 ) }
970
961
}
971
962
972
963
impl < ' a , K , V > ExactSizeIterator for Keys < ' a , K , V > {
@@ -975,8 +966,7 @@ impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {
975
966
976
967
/// An insertion-order iterator over a `LinkedHashMap`'s values.
977
968
pub struct Values < ' a , K : ' a , V : ' a > {
978
- #[ cfg_attr( feature = "clippy" , allow( type_complexity) ) ]
979
- inner : iter:: Map < Iter < ' a , K , V > , fn ( ( & ' a K , & ' a V ) ) -> & ' a V >
969
+ inner : Iter < ' a , K , V > ,
980
970
}
981
971
982
972
impl < ' a , K , V > Clone for Values < ' a , K , V > {
@@ -986,12 +976,12 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
986
976
impl < ' a , K , V > Iterator for Values < ' a , K , V > {
987
977
type Item = & ' a V ;
988
978
989
- #[ inline] fn next ( & mut self ) -> Option < ( & ' a V ) > { self . inner . next ( ) }
979
+ #[ inline] fn next ( & mut self ) -> Option < & ' a V > { self . inner . next ( ) . map ( |e| e . 1 ) }
990
980
#[ inline] fn size_hint ( & self ) -> ( usize , Option < usize > ) { self . inner . size_hint ( ) }
991
981
}
992
982
993
983
impl < ' a , K , V > DoubleEndedIterator for Values < ' a , K , V > {
994
- #[ inline] fn next_back ( & mut self ) -> Option < ( & ' a V ) > { self . inner . next_back ( ) }
984
+ #[ inline] fn next_back ( & mut self ) -> Option < & ' a V > { self . inner . next_back ( ) . map ( |e| e . 1 ) }
995
985
}
996
986
997
987
impl < ' a , K , V > ExactSizeIterator for Values < ' a , K , V > {
0 commit comments