match bool -> if/else
@@ -113,23 +113,12 @@ impl<I, J> Iterator for InterleaveShortest<I, J>
#[inline]
fn next(&mut self) -> Option<Self::Item> {
- match self.phase {
- false => match self.it0.next() {
- None => None,
- e => {
- self.phase = true;
- e
+ let e = if self.phase { self.it1.next() } else { self.it0.next() };
+ if e.is_some() {
+ self.phase = !self.phase;
}
- },
- true => match self.it1.next() {
- None => None,
- e => {
- self.phase = false;
e
}
- },
- }
- }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
