about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2019-07-11 14:49:15 -0700
committerJosh Stone <jistone@redhat.com>2019-08-12 15:03:44 -0700
commit27ddbf4d168875605295c8bdc145c5026188de27 (patch)
tree85fb8f56e38079a21409d356f2bac1472260af96
parent9ef95ff4a68ffbeaec09900c5980bfe20ca250c1 (diff)
downloadrust-27ddbf4d168875605295c8bdc145c5026188de27.tar.gz
rust-27ddbf4d168875605295c8bdc145c5026188de27.zip
Avoid closures in the default <Zip as ZipImpl>::next
-rw-r--r--src/libcore/iter/adapters/zip.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libcore/iter/adapters/zip.rs b/src/libcore/iter/adapters/zip.rs
index 06f047d9287..430ceacdd9f 100644
--- a/src/libcore/iter/adapters/zip.rs
+++ b/src/libcore/iter/adapters/zip.rs
@@ -94,11 +94,9 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
 
     #[inline]
     default fn next(&mut self) -> Option<(A::Item, B::Item)> {
-        self.a.next().and_then(|x| {
-            self.b.next().and_then(|y| {
-                Some((x, y))
-            })
-        })
+        let x = self.a.next()?;
+        let y = self.b.next()?;
+        Some((x, y))
     }
 
     #[inline]