Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #91241 - dtolnay:firstchunk, r=oli-obk
Eliminate an unreachable codepath from String::from_utf8_lossy `Utf8Lossy`'s `Iterator` implementation ensures that only the **final** chunk has an empty slice for `broken`: /~https://github.com/rust-lang/rust/blob/dd549dcab404ec4c7d07b5a83aca5bdd7171138f/library/core/src/str/lossy.rs#L46-L47 Thus the only way the **first** chunk could have an empty `broken` is if it is the **final** chunk, i.e. there is only one chunk total. And the only way that there could be one chunk total with an empty `broken` is if the whole input is valid utf8 and non-empty. That condition has already been handled by an early return, so at the point that the first `REPLACEMENT` is being pushed, it's impossible for `first_broken` to be empty.
- Loading branch information