This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,31 @@ mod foo {
196
196
//~| NOTE: this is cfg-gated and may require further changes
197
197
}
198
198
199
+ // Should not warn.
200
+ async fn inner_async ( x : & mut i32 , y : & mut u32 ) {
201
+ async {
202
+ * y += 1 ;
203
+ * x += 1 ;
204
+ }
205
+ . await ;
206
+ }
207
+
208
+ async fn inner_async2 ( x : & mut i32 , y : & mut u32 ) {
209
+ //~^ ERROR: this argument is a mutable reference, but not used mutably
210
+ async {
211
+ * x += 1 ;
212
+ }
213
+ . await ;
214
+ }
215
+
216
+ async fn inner_async3 ( x : & mut i32 , y : & mut u32 ) {
217
+ //~^ ERROR: this argument is a mutable reference, but not used mutably
218
+ async {
219
+ * y += 1 ;
220
+ }
221
+ . await ;
222
+ }
223
+
199
224
fn main ( ) {
200
225
let mut u = 0 ;
201
226
let mut v = vec ! [ 0 ] ;
Original file line number Diff line number Diff line change @@ -94,5 +94,17 @@ LL | fn cfg_warn(s: &mut u32) {}
94
94
|
95
95
= note: this is cfg-gated and may require further changes
96
96
97
- error: aborting due to 15 previous errors
97
+ error: this argument is a mutable reference, but not used mutably
98
+ --> $DIR/needless_pass_by_ref_mut.rs:208:39
99
+ |
100
+ LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
101
+ | ^^^^^^^^ help: consider changing to: `&u32`
102
+
103
+ error: this argument is a mutable reference, but not used mutably
104
+ --> $DIR/needless_pass_by_ref_mut.rs:216:26
105
+ |
106
+ LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
107
+ | ^^^^^^^^ help: consider changing to: `&i32`
108
+
109
+ error: aborting due to 17 previous errors
98
110
You can’t perform that action at this time.
0 commit comments