mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Remove unneeded saturating_add
This commit is contained in:
parent
1cc8b6ec66
commit
5199a7060b
@ -432,7 +432,10 @@ impl<'a> Iterator for Chars<'a> {
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let (len, _) = self.iter.size_hint();
|
||||
(len.saturating_add(3) / 4, Some(len))
|
||||
// `(len + 3)` can't overflow, because we know that the `slice::Iter`
|
||||
// belongs to a slice in memory which has a maximum length of
|
||||
// `isize::MAX` (that's well below `usize::MAX`).
|
||||
((len + 3) / 4, Some(len))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user