Closed
Description
Summary
needless_pass_by_ref_mut
false positive
I think it's another variant of #11179, sorry if this issue is a duplicate.
Lint Name
needless_pass_by_ref_mut
Reproducer
I tried this code:
async fn f(x: &mut i32) {
async {
*x += 1;
}
.await;
}
I saw this happen:
❯ cargo +nightly clippy
warning: this argument is a mutable reference, but not used mutably
--> src/main.rs:8:15
|
8 | async fn f(x: &mut i32) {
| ^^^^^^^^ help: consider changing to: `&i32`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
= note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default
I expected to see this happen:
No warning
Version
rustc 1.73.0-nightly (eb088b8b9 2023-08-05)
binary: rustc
commit-hash: eb088b8b9d98f1af1b0e61bbdcd8686e1b0db7b6
commit-date: 2023-08-05
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
Additional Labels
No response