Avoid closures in Peekable

This commit is contained in:
Josh Stone 2019-07-11 17:51:24 -07:00
parent df3d686598
commit ff60eca7a1

View File

@ -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)
}