-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an example of lossy decoding to str::Utf8Error docs #49105
Add an example of lossy decoding to str::Utf8Error docs #49105
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cramertj (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/libcore/str/mod.rs
Outdated
/// } | ||
/// push("\u{FFFD}"); | ||
/// | ||
/// match error.error_len() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just stylistic comment. I think that this match
taking 8 lines is artificially too long, you could make it 5 lines with if let
.
if let Some(invalid_sequence_length) = error.error_len() {
input = &after_valid[invalid_sequence_length..];
} else {
break;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does look better. Applied, thanks.
b2f4589
to
e09dbbc
Compare
@bors: r+ rollup |
📌 Commit e09dbbc has been approved by |
… r=alexcrichton Add an example of lossy decoding to str::Utf8Error docs CC rust-lang#33906
CC #33906