Skip to content

Commit

Permalink
Avoid closures in Peekable
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jul 12, 2019
1 parent c288eb9 commit 7548974
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcore/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,10 @@ impl<I: Iterator> Iterator for Peekable<I> {
};
let (lo, hi) = self.iter.size_hint();
let lo = lo.saturating_add(peek_len);
let hi = hi.and_then(|x| x.checked_add(peek_len));
let hi = match hi {
Some(x) => x.checked_add(peek_len),
None => None,
};
(lo, hi)
}

Expand Down

0 comments on commit 7548974

Please sign in to comment.