Skip to content

Commit 27f7615

Browse files
committed
fix style nits
1 parent 6c94089 commit 27f7615

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/libcore/iter/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
10861086

10871087
#[inline]
10881088
fn next(&mut self) -> Option<I::Item> {
1089-
for x in self.iter.by_ref() {
1089+
for x in &mut self.iter {
10901090
if (self.predicate)(&x) {
10911091
return Some(x);
10921092
}
@@ -1101,13 +1101,12 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
11011101
}
11021102

11031103
#[inline]
1104-
fn count(self) -> usize {
1105-
let (mut c, mut predicate, mut iter) = (0, self.predicate, self.iter);
1106-
for x in iter.by_ref() {
1107-
// branchless count
1108-
c += (&mut predicate)(&x) as usize;
1104+
fn count(mut self) -> usize {
1105+
let mut count = 0;
1106+
for x in &mut self.iter {
1107+
count += (self.predicate)(&x) as usize;
11091108
}
1110-
c
1109+
count
11111110
}
11121111
}
11131112

0 commit comments

Comments
 (0)