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 {
196196 //~| NOTE: this is cfg-gated and may require further changes
197197}
198198
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+
199224fn main ( ) {
200225 let mut u = 0 ;
201226 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) {}
9494 |
9595 = note: this is cfg-gated and may require further changes
9696
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
98110
You can’t perform that action at this time.
0 commit comments