-
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
Tracking issue for adding #[must_use] annotations throughout the standard library #89692
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
This comment has been minimized.
This comment has been minimized.
Error: Label P-low can only be set by Rust team members Please let |
rustbot
added
A-diagnostics
Area: Messages for errors, warnings, and lints
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
labels
Oct 9, 2021
This was referenced Oct 9, 2021
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 9, 2021
…err-locks, r=joshtriplett Add #[must_use] to stdin/stdout/stderr locks Affected methods: ```rust std::io fn stdin_locked() -> StdinLock<'static>; std::io::Stdin fn lock(&self) -> StdinLock<'_>; std::io fn stdout_locked() -> StdoutLock<'static>; std::io::Stdout fn lock(&self) -> StdoutLock<'_>; std::io fn stderr_locked() -> StderrLock<'static>; std::io::Stderr fn lock(&self) -> StderrLock<'_>; ``` Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
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
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 9, 2021
…err-locks, r=joshtriplett Add #[must_use] to stdin/stdout/stderr locks Affected methods: ```rust std::io fn stdin_locked() -> StdinLock<'static>; std::io::Stdin fn lock(&self) -> StdinLock<'_>; std::io fn stdout_locked() -> StdoutLock<'static>; std::io::Stdout fn lock(&self) -> StdoutLock<'_>; std::io fn stderr_locked() -> StderrLock<'static>; std::io::Stderr fn lock(&self) -> StderrLock<'_>; ``` Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
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
This was referenced Oct 10, 2021
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ts, r=joshtriplett Add #[must_use] to is_condition tests There's nothing insightful to say about these so I didn't write any extra explanations. Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ods, r=joshtriplett Add #[must_use] to char escape methods Parent issue: rust-lang#89692
This was referenced Oct 10, 2021
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ts, r=joshtriplett Add #[must_use] to is_condition tests There's nothing insightful to say about these so I didn't write any extra explanations. Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ods, r=joshtriplett Add #[must_use] to char escape methods Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
… r=joshtriplett Add #[must_use] to math and bit manipulation methods Also tidied up a few other nearby `#[must_use]`s. Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ts, r=joshtriplett Add #[must_use] to is_condition tests There's nothing insightful to say about these so I didn't write any extra explanations. Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
…ods, r=joshtriplett Add #[must_use] to char escape methods Parent issue: rust-lang#89692
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 10, 2021
… r=joshtriplett Add #[must_use] to math and bit manipulation methods Also tidied up a few other nearby `#[must_use]`s. Parent issue: rust-lang#89692
This was referenced Oct 10, 2021
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 11, 2021
…ove-self, r=joshtriplett Add #[must_use] to conversions that move self Everything here got the same message. Is the wording okay? ```rust #[must_use = "`self` will be dropped if the result is not used"] ``` I want to draw attention to these methods in particular: ```rust alloc::sync::Arc<MaybeUninit<T>> unsafe fn assume_init(self) -> Arc<T>; alloc::sync::Arc<[MaybeUninit<T>]> unsafe fn assume_init(self) -> Arc<[T]>; core::pin::Pin<&'a mut T> const fn into_ref(self) -> Pin<&'a T>; core::pin::Pin<&'a mut T> const fn get_mut(self) -> &'a mut T; core::pin::Pin<&'a mut T> const unsafe fn get_unchecked_mut(self) -> &'a mut T; core::pin::Pin<&'a mut T> unsafe fn map_unchecked_mut(self, func: F) -> Pin<&'a mut U>; core::pin::Pin<&'a mut Pin<P>> fn as_deref_mut(self) -> Pin<&'a mut P::Target>; ``` Parent issue: rust-lang#89692 r? `@joshtriplett`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 11, 2021
…rs, r=joshtriplett Add #[must_use] to alloc constructors Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add. I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular: * The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with. * `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory? Parent issue: rust-lang#89692 r? `@joshtriplett`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Oct 11, 2021
…ctors, r=joshtriplett Add #[must_use] to core and std constructors Parent issue: rust-lang#89692 r? `@joshtriplett`
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 4, 2022
…lett add #[must_use] to functions of slice and its iterators. See rust-lang#89692.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Mar 26, 2022
add #[must_use] to functions of slice and its iterators. Continuation of rust-lang#92853. Tracking issue: rust-lang#89692.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 26, 2022
add #[must_use] to functions of slice and its iterators. Continuation of rust-lang#92853. Tracking issue: rust-lang#89692.
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Apr 7, 2022
add #[must_use] to functions of slice and its iterators. Continuation of rust-lang#92853. Tracking issue: rust-lang#89692.
This was referenced Jul 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
This is a tracking issue for a large scale effort to comb the standard library and add missing
#[must_use]
annotations. Due to the number of edits being made—over 800—I'm doing it in many small PRs.For an overview of what's being done and why see the libs-team MCP.
Pull requests
Done
List of all functions touched across all the PRs (long!)
Add #[must_use] to stdin/stdout/stderr locks #89693
Add #[must_use] to string transformation methods #89694
Add #[must_use] to is_condition checks #89718
Add #[must_use] to char escape methods #89719
Add #[must_use] to math and bit manipulation methods #89720
Add #[must_use] to alloc constructors #89726
Add #[must_use] to core and std constructors #89729
Add #[must_use] to MaybeUninit::new #89769
Add #[must_use] to from_value conversions #89753
Add #[must_use] to conversions that move self #89755
Add #[must_use] to From::from and Into::into #89770
Add #[must_use] to as_type conversions #89778
Add #[must_use] to len and is_empty #89786
Add #[must_use] to thread::Builder #89789
Add #[must_use] to to_value conversions #89794
Add #[must_use] to non-mutating verb methods #89796
Add #[must_use] to is_condition tests #89797
Add #[must_use] to Rc::downgrade #89833
Add #[must_use] to expensive computations #89835
Add #[must_use] to mem/ptr functions #89839
Add #[must_use] to remaining core functions #89897
Add #[must_use] to remaining alloc functions #89899
Add #[must_use] to alloc functions that would leak memory #90427
Add #[must_use] to remaining std functions (A-N) #90430
Add #[must_use] to remaining std functions (O-Z) #90431
Todo
Empty
Ignored
List of modules and functions I skipped
Related
#[must_use]
#[must_use]
functions in the standard library #48926The text was updated successfully, but these errors were encountered: