Added tests for bugs fixed.
This commit is contained in:
parent
d817d58fe4
commit
bb578b6e12
1 changed files with 14 additions and 0 deletions
|
|
@ -47,6 +47,20 @@ fn main() {
|
|||
let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable
|
||||
fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut a = &mut 5; //~ ERROR: variable does not need to be mutable
|
||||
*a = 4;
|
||||
|
||||
let mut a = 5;
|
||||
let mut b = (&mut a,);
|
||||
*b.0 = 4; //~^ ERROR: variable does not need to be mutable
|
||||
|
||||
fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
|
||||
&mut arg[..] //~^ ERROR: variable does not need to be mutable
|
||||
}
|
||||
|
||||
let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable
|
||||
v.push(());
|
||||
|
||||
// positive cases
|
||||
let mut a = 2;
|
||||
a = 3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue