Skip to content

Commit

Permalink
Avoid closures in the default <Zip as ZipImpl>::next
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Aug 12, 2019
1 parent 9ef95ff commit 27ddbf4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/libcore/iter/adapters/zip.rs
Expand Up @@ -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]
Expand Down

0 comments on commit 27ddbf4

Please sign in to comment.