Skip to content

Commit

Permalink
Prefer pop_front over explicit is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
phimuemue committed May 6, 2020
1 parent 2c6b6ed commit 3ada070
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/multipeek_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ impl<I> Iterator for MultiPeek<I>

fn next(&mut self) -> Option<I::Item> {
self.index = 0;
if self.buf.is_empty() {
self.iter.next()
} else {
self.buf.pop_front()
}
self.buf.pop_front().or_else(|| self.iter.next())
}

fn size_hint(&self) -> (usize, Option<usize>) {
Expand Down

0 comments on commit 3ada070

Please sign in to comment.