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 Aug 12, 2019
1 parent df3d686 commit ff60eca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcore/iter/adapters/mod.rs
Expand Up @@ -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)
}

Expand Down

0 comments on commit ff60eca

Please sign in to comment.