Update UI test for async blocks for NEEDLESS_PASS_BY_REF_MUT
This commit is contained in:
parent
42186af21e
commit
1d01f1bac1
@ -196,6 +196,31 @@ fn cfg_warn(s: &mut u32) {}
|
||||
//~| NOTE: this is cfg-gated and may require further changes
|
||||
}
|
||||
|
||||
// Should not warn.
|
||||
async fn inner_async(x: &mut i32, y: &mut u32) {
|
||||
async {
|
||||
*y += 1;
|
||||
*x += 1;
|
||||
}
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn inner_async2(x: &mut i32, y: &mut u32) {
|
||||
//~^ ERROR: this argument is a mutable reference, but not used mutably
|
||||
async {
|
||||
*x += 1;
|
||||
}
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn inner_async3(x: &mut i32, y: &mut u32) {
|
||||
//~^ ERROR: this argument is a mutable reference, but not used mutably
|
||||
async {
|
||||
*y += 1;
|
||||
}
|
||||
.await;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut u = 0;
|
||||
let mut v = vec![0];
|
||||
|
@ -94,5 +94,17 @@ LL | fn cfg_warn(s: &mut u32) {}
|
||||
|
|
||||
= note: this is cfg-gated and may require further changes
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/needless_pass_by_ref_mut.rs:208:39
|
||||
|
|
||||
LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&u32`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/needless_pass_by_ref_mut.rs:216:26
|
||||
|
|
||||
LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user