File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ where
123
123
/// Returns true if iteration has started and has not yet finished; false
124
124
/// otherwise.
125
125
fn in_progress ( & self ) -> bool {
126
- self . 0 . last ( ) . map_or ( false , |last| last . in_progress ( ) )
126
+ self . 0 . last ( ) . map_or ( false , MultiProductIter :: in_progress)
127
127
}
128
128
}
129
129
Original file line number Diff line number Diff line change 76
76
let inner_hint = |inner : & Option < T :: IntoIter > | {
77
77
inner
78
78
. as_ref ( )
79
- . map ( Iterator :: size_hint)
80
- . unwrap_or ( ( 0 , Some ( 0 ) ) )
79
+ . map_or ( ( 0 , Some ( 0 ) ) , Iterator :: size_hint)
81
80
} ;
82
81
let inner_front = inner_hint ( & self . inner_front ) ;
83
82
let inner_back = inner_hint ( & self . inner_back ) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ where
112
112
if client < self . oldest_buffered_group {
113
113
return None ;
114
114
}
115
- let elt = self . buffer . get_mut ( bufidx) . and_then ( |queue| queue . next ( ) ) ;
115
+ let elt = self . buffer . get_mut ( bufidx) . and_then ( Iterator :: next) ;
116
116
if elt. is_none ( ) && client == self . oldest_buffered_group {
117
117
// FIXME: VecDeque is unfortunately not zero allocation when empty,
118
118
// so we do this job manually.
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ where
226
226
#[ allow( deprecated) ] //TODO: once msrv hits 1.51. replace `fold1` with `reduce`
227
227
self . heap
228
228
. iter ( )
229
- . map ( |i| i . size_hint ( ) )
229
+ . map ( HeadTail :: size_hint)
230
230
. fold1 ( size_hint:: add)
231
231
. unwrap_or ( ( 0 , Some ( 0 ) ) )
232
232
}
Original file line number Diff line number Diff line change
1
+ // Use a Hashmap for the entry API in order to prevent hashing twice.
2
+ // This can maybe be replaced with e a HashSet once `get_or_insert_with`
3
+ // // or a proper Entry API for Hashset is stable and meets the msrv
4
+ #![ allow( clippy:: zero_sized_map_values) ]
5
+
1
6
use std:: collections:: hash_map:: Entry ;
2
7
use std:: collections:: HashMap ;
3
8
use std:: fmt;
@@ -11,9 +16,7 @@ use std::iter::FusedIterator;
11
16
#[ must_use = "iterator adaptors are lazy and do nothing unless consumed" ]
12
17
pub struct UniqueBy < I : Iterator , V , F > {
13
18
iter : I ,
14
- // Use a Hashmap for the Entry API in order to prevent hashing twice.
15
- // This can maybe be replaced with a HashSet once `get_or_insert_with`
16
- // or a proper Entry API for Hashset is stable and meets this msrv
19
+ // see comment for `allow(clippy::zero_sized_map_values)` for reasoning
17
20
used : HashMap < V , ( ) > ,
18
21
f : F ,
19
22
}
You can’t perform that action at this time.
0 commit comments