Skip to content

Commit d1fffd8

Browse files
committed
Added closure test case.
1 parent 9c854db commit d1fffd8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/compile-fail/lint-unused-mut-variables.rs

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ fn main() {
5454
let mut b = (&mut a,);
5555
*b.0 = 4; //~^ ERROR: variable does not need to be mutable
5656

57+
let mut x = &mut 1; //~ ERROR: variable does not need to be mutable
58+
let mut f = || {
59+
*x += 1;
60+
};
61+
f();
62+
5763
fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
5864
&mut arg[..] //~^ ERROR: variable does not need to be mutable
5965
}

0 commit comments

Comments
 (0)