Add #[must_use] to string/char transformation methods#89694
Merged
bors merged 2 commits intorust-lang:masterfrom Oct 9, 2021
Merged
Add #[must_use] to string/char transformation methods#89694bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
These methods could be misconstrued as modifying their arguments instead of returning new values. Where possible I made the note recommend a method that does mutate in place.
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
joshtriplett
reviewed
Oct 9, 2021
Member
|
r=me with the copy-paste issue corrected. |
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
Member
|
@bors r+ |
Collaborator
|
📌 Commit 2ec7588 has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 9, 2021
…s, r=joshtriplett Add #[must_use] to string/char transformation methods These methods could be misconstrued as modifying their arguments instead of returning new values. Where possible I made the note recommend a method that does mutate in place. Parent issue: rust-lang#89692
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 9, 2021
…askrgr Rollup of 10 pull requests Successful merges: - rust-lang#88707 (String.split_terminator: Add an example when using a slice of chars) - rust-lang#89605 (Fix stabilization version for `bindings_after_at`) - rust-lang#89634 (rustc_driver: Enable the `WARN` log level by default) - rust-lang#89641 (make #[target_feature] work with `asm` register classes) - rust-lang#89678 (Fix minor std::thread documentation typo) - rust-lang#89684 (Fix asm docs typo) - rust-lang#89687 (Move `read2_abbreviated` function into read2.rs) - rust-lang#89693 (Add #[must_use] to stdin/stdout/stderr locks) - rust-lang#89694 (Add #[must_use] to string/char transformation methods) - rust-lang#89697 (Fix min LLVM version for bpf-types test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 12, 2021
…b-methods, r=joshtriplett Add #[must_use] to non-mutating verb methods These are methods that could be misconstrued to mutate their input, similar to rust-lang#89694. I gave each one a different custom message. I wrote that `upgrade` and `downgrade` don't modify the input pointers. Logically they don't, but technically they do... Parent issue: rust-lang#89692 r? `@joshtriplett`
Ltrlg
reviewed
Oct 12, 2021
| /// [`make_ascii_uppercase`]: str::make_ascii_uppercase | ||
| /// [`to_uppercase`]: #method.to_uppercase | ||
| #[cfg(not(no_global_oom_handling))] | ||
| #[must_use = "to uppercase the value in-place, use `make_ascii_lowercase()`"] |
Member
There was a problem hiding this comment.
Good catch. There was a similar copy-paste issue that was corrected, but this one wasn't.
the8472
added a commit
to the8472/rust
that referenced
this pull request
Oct 12, 2021
…b-methods, r=joshtriplett Add #[must_use] to non-mutating verb methods These are methods that could be misconstrued to mutate their input, similar to rust-lang#89694. I gave each one a different custom message. I wrote that `upgrade` and `downgrade` don't modify the input pointers. Logically they don't, but technically they do... Parent issue: rust-lang#89692 r? ``@joshtriplett``
the8472
added a commit
to the8472/rust
that referenced
this pull request
Oct 12, 2021
…b-methods, r=joshtriplett Add #[must_use] to non-mutating verb methods These are methods that could be misconstrued to mutate their input, similar to rust-lang#89694. I gave each one a different custom message. I wrote that `upgrade` and `downgrade` don't modify the input pointers. Logically they don't, but technically they do... Parent issue: rust-lang#89692 r? ```@joshtriplett```
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Oct 13, 2021
…s-typo, r=joshtriplett Fix uppercase/lowercase error Fix rust-lang#89694 (comment) r? ``@joshtriplett``
the8472
added a commit
to the8472/rust
that referenced
this pull request
Oct 13, 2021
…s-typo, r=joshtriplett Fix uppercase/lowercase error Fix rust-lang#89694 (comment) r? ```@joshtriplett```
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Oct 13, 2021
…s-typo, r=joshtriplett Fix uppercase/lowercase error Fix rust-lang#89694 (comment) r? ````@joshtriplett````
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These methods could be misconstrued as modifying their arguments instead of returning new values.
Where possible I made the note recommend a method that does mutate in place.
Parent issue: #89692