Rollup merge of #152823 - Zeromemer:fix-stale-comments, r=jhpratt

fix stale comments left over from ed3711e

Remove stale overflow comments in core::str.

Commit ed3711ea introduced stale comments in library/core/src/str/iter.rs.

Prior to that commit, the comments explained why `(len + 3)` and `(len + 2)` couldn't overflow.
Since the code now uses `div_ceil`, these specific overflow justifications are no longer relevant to the current implementation.
This commit is contained in:
Jonathan Brouwer
2026-02-19 10:56:40 +01:00
committed by GitHub
-6
View File
@@ -99,9 +99,6 @@ fn advance_by(&mut self, mut remainder: usize) -> Result<(), NonZero<usize>> {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
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<usize>) {
// 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 {