-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
Following Clippy's suggestion and removing &mut from &mut data would lead to data (which is a built-in arrray) being copied instead of being mutated.
See also https://users.rust-lang.org/t/false-positive-for-clippy-needless-borrows-for-generic-args/138147.
Lint Name
needless_borrows_for_generic_args
Reproducer
Go to https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5f88142da1ad985c8da2d12c22a7bac9 and run Clippy.
I saw this happen:
warning: the borrowed expression implements the required traits
--> src/main.rs:10:13
|
10 | process(&mut data);
| ^^^^^^^^^ help: change this to: `data`
|
I expected to see this happen:
no warning
Version
Additional Labels
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have