Remove unneeded saturating_add

This commit is contained in:
Tobias Bucher 2015-03-10 14:18:24 +01:00
parent 1cc8b6ec66
commit 5199a7060b

View File

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