-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rename &str::as_bytes() to &str::as_utf8() #14131
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
Comments
The iterator yield one byte at a time, so it probably makes sense for them to keep "bytes" in the name: |
|
@kballard I think that |
@SimonSapin Yes, small library changes like this don't need to go through the RFC process. +1 for me on the suggested renaming; I think the guidelines are pretty clear about |
I don't like this rename, &str is obviously utf-8 encoded, don't need |
+1 for renaming. (Outside chance for the iterator: |
@liigo has a good point. |
@aturon Does this still sound like something you want? |
@SimonSapin Sorry for the slow response. I'm going to mark this as closed, since (Personally, I'm happy either way, but we needed to make a decision and I think the stabilization gives a reasonable rationale.) |
fix: don't include `r#` prefix in filesystem changes Fixes rust-lang#14131 In addition to fix for rust-lang#14131, this PR adds raw ident validity checks in rename functionality that we've been missing.
A `ref` pattern applied to an argument is not ignored. It creates a reference as expected, but still requires the function to take ownership of the argument given to it. Fix rust-lang#14131 changelog: [`toplevel_ref_arg`]: use a clearer lint message
This seemed small enough to not be worth an RFC. Please correct me if it’s not.
Similar to how the
str::from_bytes
function was renamed tostr::from_utf8
, the&str::as_bytes
method should be renamed to something that indicate UTF-8, possibly&str::as_utf8
or&str::as_utf8_bytes
.The
&str::bytes
and&str::bytes_rev
iterators, the~str::into_bytes
method, and theStrBuf
equivalent to all of the above should also be renamed accordingly.The text was updated successfully, but these errors were encountered: