Skip to content

Commit

Permalink
Added closure test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanbakel committed Aug 6, 2017
1 parent 9c854db commit d1fffd8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/compile-fail/lint-unused-mut-variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d1fffd8

Please sign in to comment.