mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Avoid closures in Peekable
This commit is contained in:
parent
df3d686598
commit
ff60eca7a1
@ -1235,7 +1235,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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user