From 918f70f628e9c225eb42c92b9acf2a999b34f6ee Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 9 Nov 2018 00:03:17 +0100 Subject: [PATCH] Removed an unneeded instance of `// revisions`; the compare-mode NLL shows the output is identical now. --- .../lint/lint-unused-mut-variables.nll.stderr | 150 ------------------ src/test/ui/lint/lint-unused-mut-variables.rs | 72 ++++----- ...tderr => lint-unused-mut-variables.stderr} | 32 ++-- 3 files changed, 52 insertions(+), 202 deletions(-) delete mode 100644 src/test/ui/lint/lint-unused-mut-variables.nll.stderr rename src/test/ui/lint/{lint-unused-mut-variables.lexical.stderr => lint-unused-mut-variables.stderr} (71%) diff --git a/src/test/ui/lint/lint-unused-mut-variables.nll.stderr b/src/test/ui/lint/lint-unused-mut-variables.nll.stderr deleted file mode 100644 index 40f68c6782781..0000000000000 --- a/src/test/ui/lint/lint-unused-mut-variables.nll.stderr +++ /dev/null @@ -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 - diff --git a/src/test/ui/lint/lint-unused-mut-variables.rs b/src/test/ui/lint/lint-unused-mut-variables.rs index 14d836074dca3..a2005ba9f72e0 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.rs +++ b/src/test/ui/lint/lint-unused-mut-variables.rs @@ -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 + } diff --git a/src/test/ui/lint/lint-unused-mut-variables.lexical.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr similarity index 71% rename from src/test/ui/lint/lint-unused-mut-variables.lexical.stderr rename to src/test/ui/lint/lint-unused-mut-variables.stderr index 40f68c6782781..60e8400c42870 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.lexical.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -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`