Avoid closures in the default <Zip as ZipImpl>::next

This commit is contained in:
Josh Stone 2019-07-11 14:49:15 -07:00
parent 9ef95ff4a6
commit 27ddbf4d16

View File

@ -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]