File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,12 @@ fn main() {
31
31
//~^ mut_mut
32
32
* * * y + * * x;
33
33
}
34
+
35
+ if fun ( x) {
36
+ // The lint will remove the extra `&mut`, but the result will still be a `&mut` of an expr
37
+ // of type `&mut _` (x), so the lint will fire again. That's because we've decided that
38
+ // doing both fixes in one run is not worth it, given how improbable code like this is.
39
+ let y = & mut & mut x;
40
+ //~^ mut_mut
41
+ }
34
42
}
Original file line number Diff line number Diff line change @@ -31,5 +31,11 @@ error: an expression of form `&mut &mut _`
31
31
LL | let y = &mut &mut &mut 2;
32
32
| ^^^^^^^^^^^^^^^^ help: remove the extra `&mut`s: `&mut 2`
33
33
34
- error: aborting due to 5 previous errors
34
+ error: an expression of form `&mut &mut _`
35
+ --> tests/ui/mut_mut_unfixable.rs:39:17
36
+ |
37
+ LL | let y = &mut &mut x;
38
+ | ^^^^^^^^^^^ help: remove the extra `&mut`: `&mut x`
39
+
40
+ error: aborting due to 6 previous errors
35
41
You can’t perform that action at this time.
0 commit comments