diff options
| author | Isaac van Bakel <ivb@vanbakel.io> | 2017-08-06 18:25:31 +0100 |
|---|---|---|
| committer | Isaac van Bakel <ivb@vanbakel.io> | 2017-08-06 18:25:31 +0100 |
| commit | d1fffd8685748357a079711dde1ae22560c6cd70 (patch) | |
| tree | dacf3661861080097eb5803e4b1f01527db9ffb3 | |
| parent | 9c854db82b767ddd228dbff1e51bb3eed87464b4 (diff) | |
| download | rust-d1fffd8685748357a079711dde1ae22560c6cd70.tar.gz rust-d1fffd8685748357a079711dde1ae22560c6cd70.zip | |
Added closure test case.
| -rw-r--r-- | src/test/compile-fail/lint-unused-mut-variables.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index 49ba9421d65..26d00755da3 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -54,6 +54,12 @@ fn main() { let mut b = (&mut a,); *b.0 = 4; //~^ ERROR: variable does not need to be mutable + let mut x = &mut 1; //~ ERROR: variable does not need to be mutable + let mut f = || { + *x += 1; + }; + f(); + fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { &mut arg[..] //~^ ERROR: variable does not need to be mutable } |
