-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[needless_pass_by_ref_mut
]: Do not lint if passed as a fn-like argument
#11207
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
Conversation
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
&mut
closureneedless_pass_by_ref_mut
]: Do not lint if passed as a fn-like argument
929e266
to
3a3961a
Compare
I think this fix would still lint incorrectly on my provided example in one of the linked issues: #11199 (comment) |
Yeah and I believe it'll still lint stuff like fn then(a: &mut u32) {}
fn els(a: &mut u32) {
*a = 2;
}
if true {
then
} else {
els
} Which isn't good |
☔ The latest upstream changes (presumably #11184) made this pull request unmergeable. Please resolve the merge conflicts. |
Looks good to me, great work! |
@bors r+ Thanks! |
[`needless_pass_by_ref_mut`]: Do not lint if passed as a fn-like argument Fixes #11182 and also fixes #11199 (though this is kind of a duplicate) There's likely a case or two I've missed, so this likely needs a bit more work but it seems to work fine with the tests I've added. PS, the diff for the test is useless because it iterates over a hashmap before linting. Seems to work fine but we could maybe change this for consistency's sake changelog: [`needless_pass_by_ref_mut`]: No longer lints if the function is passed as a fn-like argument
💔 Test failed - checks-action_test |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #11182 and also fixes #11199 (though this is kind of a duplicate)
There's likely a case or two I've missed, so this likely needs a bit more work but it seems to work fine with the tests I've added.
PS, the diff for the test is useless because it iterates over a hashmap before linting. Seems to work fine but we could maybe change this for consistency's sake
changelog: [
needless_pass_by_ref_mut
]: No longer lints if the function is passed as a fn-like argument