Rollup merge of #55799 - pnkfelix:remove-useless-revisions-marker-from-lint-unused-mut-variables, r=davidtwco
Removed unneeded instance of `// revisions` from a lint test Removed an unneeded instance of `// revisions`; the compare-mode=nll shows the output is identical now. cc #54528
This commit is contained in:
commit
8c4bfb833b
3 changed files with 52 additions and 202 deletions
|
@ -1,150 +0,0 @@
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:59:14
|
||||
|
|
||||
LL | let x = |mut y: isize| 10; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/lint-unused-mut-variables.rs:19:9
|
||||
|
|
||||
LL | #![deny(unused_mut)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:24:9
|
||||
|
|
||||
LL | let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:26:9
|
||||
|
|
||||
LL | let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:28:9
|
||||
|
|
||||
LL | let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:30:9
|
||||
|
|
||||
LL | let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:32:10
|
||||
|
|
||||
LL | let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:34:9
|
||||
|
|
||||
LL | let mut a; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:38:9
|
||||
|
|
||||
LL | let mut b; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:47:9
|
||||
|
|
||||
LL | mut x => {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:51:8
|
||||
|
|
||||
LL | (mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:64:9
|
||||
|
|
||||
LL | let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:69:9
|
||||
|
|
||||
LL | let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:72:9
|
||||
|
|
||||
LL | let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:84:9
|
||||
|
|
||||
LL | let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:61:13
|
||||
|
|
||||
LL | fn what(mut foo: isize) {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:79:20
|
||||
|
|
||||
LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
|
||||
| ----^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:143:9
|
||||
|
|
||||
LL | let mut b = vec![2]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/lint-unused-mut-variables.rs:139:8
|
||||
|
|
||||
LL | #[deny(unused_mut)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// revisions: lexical nll
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
|
||||
|
||||
// Exercise the unused_mut attribute in some positive and negative cases
|
||||
|
||||
|
@ -21,22 +21,22 @@
|
|||
|
||||
fn main() {
|
||||
// negative cases
|
||||
let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut a; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut a = 3; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut a = 2; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut b = 3; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut a = vec![3]; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut a; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
a = 3;
|
||||
|
||||
let mut b; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut b; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
if true {
|
||||
b = 3;
|
||||
} else {
|
||||
|
@ -44,45 +44,45 @@ fn main() {
|
|||
}
|
||||
|
||||
match 30 {
|
||||
mut x => {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
mut x => {} //~ ERROR: variable does not need to be mutable
|
||||
|
||||
}
|
||||
match (30, 2) {
|
||||
(mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
(mut x, 1) | //~ ERROR: variable does not need to be mutable
|
||||
|
||||
(mut x, 2) |
|
||||
(mut x, 3) => {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let x = |mut y: isize| 10; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
fn what(mut foo: isize) {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
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
|
||||
|
||||
let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
*a = 4;
|
||||
|
||||
let mut a = 5;
|
||||
let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
*b.0 = 4; //[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable
|
||||
*b.0 = 4;
|
||||
|
||||
let mut x = &mut 1; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ 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[..] //[lexical]~^ ERROR: variable does not need to be mutable
|
||||
//[nll]~^^ ERROR: variable does not need to be mutable
|
||||
&mut arg[..] //~^ ERROR: variable does not need to be mutable
|
||||
|
||||
}
|
||||
|
||||
let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ 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
|
||||
|
@ -140,6 +140,6 @@ fn foo(mut a: isize) {
|
|||
fn bar() {
|
||||
#[allow(unused_mut)]
|
||||
let mut a = 3;
|
||||
let mut b = vec![2]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
//[nll]~^ ERROR: variable does not need to be mutable
|
||||
let mut b = vec![2]; //~ ERROR: variable does not need to be mutable
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:59:14
|
||||
|
|
||||
LL | let x = |mut y: isize| 10; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -15,7 +15,7 @@ LL | #![deny(unused_mut)]
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:24:9
|
||||
|
|
||||
LL | let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut a = 3; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -23,7 +23,7 @@ LL | let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:26:9
|
||||
|
|
||||
LL | let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut a = 2; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -31,7 +31,7 @@ LL | let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:28:9
|
||||
|
|
||||
LL | let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut b = 3; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -39,7 +39,7 @@ LL | let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:30:9
|
||||
|
|
||||
LL | let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -47,7 +47,7 @@ LL | let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be m
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:32:10
|
||||
|
|
||||
LL | let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -55,7 +55,7 @@ LL | let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:34:9
|
||||
|
|
||||
LL | let mut a; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut a; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -63,7 +63,7 @@ LL | let mut a; //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:38:9
|
||||
|
|
||||
LL | let mut b; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut b; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -71,7 +71,7 @@ LL | let mut b; //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:47:9
|
||||
|
|
||||
LL | mut x => {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | mut x => {} //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -79,7 +79,7 @@ LL | mut x => {} //[lexical]~ ERROR: variable does not need to be mutabl
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:51:8
|
||||
|
|
||||
LL | (mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -87,7 +87,7 @@ LL | (mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:64:9
|
||||
|
|
||||
LL | let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -95,7 +95,7 @@ LL | let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mu
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:69:9
|
||||
|
|
||||
LL | let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -103,7 +103,7 @@ LL | let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:72:9
|
||||
|
|
||||
LL | let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -111,7 +111,7 @@ LL | let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mu
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:84:9
|
||||
|
|
||||
LL | let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -119,7 +119,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable do
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:61:13
|
||||
|
|
||||
LL | fn what(mut foo: isize) {} //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable
|
||||
| ----^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
@ -135,7 +135,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
|
|||
error: variable does not need to be mutable
|
||||
--> $DIR/lint-unused-mut-variables.rs:143:9
|
||||
|
|
||||
LL | let mut b = vec![2]; //[lexical]~ ERROR: variable does not need to be mutable
|
||||
LL | let mut b = vec![2]; //~ ERROR: variable does not need to be mutable
|
||||
| ----^
|
||||
| |
|
||||
| help: remove this `mut`
|
Loading…
Add table
Reference in a new issue