-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
return_self_not_must_use
contradicts double_must_use
for #[must_use]
-types
#8140
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Comments
Ah indeed, I'll add a check to ensure a |
This was referenced Dec 19, 2021
bors bot
added a commit
to foresterre/cargo-msrv
that referenced
this issue
Dec 20, 2021
218: make 'builder' 'must_use' r=foresterre a=danieleades make the `ConfigBuilder` 'must_use'. There's no valid reason ever to not use a builder struct, hence it makes sense to mark it as `#[must_use]` note that there's actually a false positive in clippy right now which is related to this - rust-lang/rust-clippy#8140 Co-authored-by: Daniel Eades <danieleades@hotmail.com>
This was referenced Dec 26, 2021
this is still failing all my builds. any idea when the fix will come through the pipeline? |
The changes have been synced about 6 hours ago, it should be fixed with the next sync :) |
foresterre
pushed a commit
to foresterre/cargo-msrv
that referenced
this issue
Aug 1, 2022
218: make 'builder' 'must_use' r=foresterre a=danieleades make the `ConfigBuilder` 'must_use'. There's no valid reason ever to not use a builder struct, hence it makes sense to mark it as `#[must_use]` note that there's actually a false positive in clippy right now which is related to this - rust-lang/rust-clippy#8140 Co-authored-by: Daniel Eades <danieleades@hotmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
With
#![warn(clippy::return_self_not_must_use)]
, Clippy wants me to mark a method returningSelf
with#[must_use]
even ifSelf
is a#[must_use]
-type.A
#[must_use]
-type renders any methods returningSelf
#[must_use]
already. Adding#[must_use]
on the method is duplication (the method is transitively must-use). Doing so anyway rightly triggers the lintdouble_must_use
. Hence,return_self_not_must_use
contradictsdouble_must_use
.Lint Name
return_self_not_must_use
Reproducer
When I run the following (“code A”):
Clippy outputs:
Suggesting adding
#[must_use]
on methodf
. However, when I do this (“code B”):Then Clippy is still not happy giving the warning seen below:
I expected to see this happen:
No warnings being emitted by Clippy for Code A:
M
is marked#[must_use]
and thus methodf
transitively becomes must-use.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: