-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
redundant_clone: False positive when original value is only used in macro #10545
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
taiki-e
added
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
labels
Mar 25, 2023
taiki-e
added a commit
to taiki-e/syn-mid
that referenced
this issue
Mar 25, 2023
rust-lang/rust-clippy#10545 ``` warning: redundant clone --> examples/const_fn/src/lib.rs:25:38 | 25 | let mut function = const_function.clone(); | ^^^^^^^^ help: remove this | note: cloned value is neither consumed nor mutated --> examples/const_fn/src/lib.rs:25:24 | 25 | let mut function = const_function.clone(); | ^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone = note: `#[warn(clippy::redundant_clone)]` on by default ```
Just ran into the same with this usage |
1 task
okay, pardon for repeated cross posts. but i confirmed this issue's regression window is same as #10577 (comment) and #10517 (comment) so, i think all are affected by a same root cause? |
bors
added a commit
that referenced
this issue
Jun 5, 2023
Move `redundant_clone` to `nursery` changelog: [`redundant_clone`]: Move to `nursery` A bunch of FPs in `redundant_clone` have sprung up after upstream MIR changes: rust-lang/rust#108944 - #10870 - #10577 - #10545 - #10517 r? `@flip1995`
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
redundant_clone warns when both the cloned and modified value and the original value are used in a macro, but should not warn because the cloned value has been modified.
Lint Name
redundant_clone
Reproducer
I tried this code:
playground
I saw this happen:
I expected to see this happen: no warning
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: