diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index d2985d8a1866..283aa9a6a73a 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -99,9 +99,6 @@ fn advance_by(&mut self, mut remainder: usize) -> Result<(), NonZero> { #[inline] fn size_hint(&self) -> (usize, Option) { let len = self.iter.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.div_ceil(4), Some(len)) } @@ -1528,9 +1525,6 @@ fn size_hint(&self) -> (usize, Option) { // is therefore determined by assuming the remaining bytes contain as // many 3-byte sequences as possible. The highest bytes:code units // ratio is for 1-byte sequences, so use this for the upper bound. - // `(len + 2)` 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`) if self.extra == 0 { (len.div_ceil(3), Some(len)) } else {