Auto merge of #23251 - tbu-:pr_rm_core_str_checked_add, r=alexcrichton
This commit is contained in:
commit
f899513a30
1 changed files with 4 additions and 1 deletions
|
@ -442,7 +442,10 @@ impl<'a> Iterator for Chars<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
let (len, _) = self.iter.size_hint();
|
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…
Add table
Add a link
Reference in a new issue