]> git.lizzy.rs Git - rust.git/commitdiff
fix style nits
authorAndre Bogus <bogusandre@gmail.com>
Tue, 17 Jan 2017 12:18:16 +0000 (13:18 +0100)
committerAndre Bogus <bogusandre@gmail.com>
Tue, 17 Jan 2017 12:18:16 +0000 (13:18 +0100)
src/libcore/iter/mod.rs

index 5dce60b79c99f4aaffd4e313f8402b473f666b8d..ea98265ef8de0904d04012821bf27db5bbfd7dba 100644 (file)
@@ -1086,7 +1086,7 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
 
     #[inline]
     fn next(&mut self) -> Option<I::Item> {
-        for x in self.iter.by_ref() {
+        for x in &mut self.iter {
             if (self.predicate)(&x) {
                 return Some(x);
             }
@@ -1101,13 +1101,12 @@ fn size_hint(&self) -> (usize, Option<usize>) {
     }
 
     #[inline]
-    fn count(self) -> usize {
-        let (mut c, mut predicate, mut iter) = (0, self.predicate, self.iter);
-        for x in iter.by_ref() {
-            // branchless count
-            c += (&mut predicate)(&x) as usize;
+    fn count(mut self) -> usize {
+        let mut count = 0;
+        for x in &mut self.iter {
+            count += (self.predicate)(&x) as usize;
         }
-        c
+        count
     }
 }