Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. 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 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