Reword unused variable warning

This commit is contained in:
Alex Tokarev 2020-03-23 11:02:46 +03:00
parent 8ff785011b
commit b35c30251f
22 changed files with 69 additions and 69 deletions

View File

@ -168,7 +168,7 @@ Diagnostics have the following format:
"rendered": null
},
{
"message": "consider prefixing with an underscore",
"message": "if this is intentional, prefix it with an underscore",
"code": null,
"level": "help",
"spans": [
@ -201,7 +201,7 @@ Diagnostics have the following format:
/* Optional string of the rendered version of the diagnostic as displayed
by rustc. Note that this may be influenced by the `--json` flag.
*/
"rendered": "warning: unused variable: `x`\n --> lib.rs:2:9\n |\n2 | let x = 123;\n | ^ help: consider prefixing with an underscore: `_x`\n |\n = note: `#[warn(unused_variables)]` on by default\n\n"
"rendered": "warning: unused variable: `x`\n --> lib.rs:2:9\n |\n2 | let x = 123;\n | ^ help: if this is intentional, prefix it with an underscore: `_x`\n |\n = note: `#[warn(unused_variables)]` on by default\n\n"
}
```

View File

@ -1565,7 +1565,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
}
} else {
err.multipart_suggestion(
"consider prefixing with an underscore",
"if this is intentional, prefix it with an underscore",
spans.iter().map(|span| (*span, format!("_{}", name))).collect(),
Applicability::MachineApplicable,
);

View File

@ -10,7 +10,7 @@ warning: unused variable: `foo`
--> $DIR/issue-62187-encountered-polymorphic-const.rs:15:9
|
LL | let foo = <[u8; 2]>::BIT_LEN;
| ^^^ help: consider prefixing with an underscore: `_foo`
| ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
|
= note: `#[warn(unused_variables)]` on by default

View File

@ -2,7 +2,7 @@ error: unused variable: `x`
--> $DIR/issue-17999.rs:5:13
|
LL | let x = ();
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
note: the lint level is defined here
--> $DIR/issue-17999.rs:1:9
@ -14,7 +14,7 @@ error: unused variable: `a`
--> $DIR/issue-17999.rs:7:13
|
LL | a => {}
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error: unused variable: `a`
--> $DIR/issue-22599.rs:8:19
|
LL | v = match 0 { a => 0 };
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/issue-22599.rs:1:9

View File

@ -9,7 +9,7 @@ note: the lint level is defined here
|
LL | #![deny(unused_variables)]
| ^^^^^^^^^^^^^^^^
help: consider prefixing with an underscore
help: if this is intentional, prefix it with an underscore
|
LL | E::A(_x) | E::B(_x) => {}
| ^^ ^^
@ -20,7 +20,7 @@ error: unused variable: `x`
LL | F::A(x, y) | F::B(x, y) => { y },
| ^ ^
|
help: consider prefixing with an underscore
help: if this is intentional, prefix it with an underscore
|
LL | F::A(_x, y) | F::B(_x, y) => { y },
| ^^ ^^
@ -29,13 +29,13 @@ error: unused variable: `a`
--> $DIR/issue-56685.rs:27:14
|
LL | F::C(a, b) => { 3 }
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/issue-56685.rs:27:17
|
LL | F::C(a, b) => { 3 }
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `x`
--> $DIR/issue-56685.rs:32:25
@ -43,7 +43,7 @@ error: unused variable: `x`
LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
| ^ ^
|
help: consider prefixing with an underscore
help: if this is intentional, prefix it with an underscore
|
LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
| ^^ ^^
@ -54,7 +54,7 @@ error: unused variable: `x`
LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
| ^ ^
|
help: consider prefixing with an underscore
help: if this is intentional, prefix it with an underscore
|
LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
| ^^ ^^

View File

@ -2,7 +2,7 @@ warning: unused variable: `i_think_continually`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:26:9
|
LL | let i_think_continually = 2;
| ^^^^^^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_i_think_continually`
| ^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_i_think_continually`
|
note: the lint level is defined here
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9
@ -15,19 +15,19 @@ warning: unused variable: `mut_unused_var`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:13
|
LL | let mut mut_unused_var = 1;
| ^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_mut_unused_var`
| ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_mut_unused_var`
warning: unused variable: `var`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:14
|
LL | let (mut var, unused_var) = (1, 2);
| ^^^ help: consider prefixing with an underscore: `_var`
| ^^^ help: if this is intentional, prefix it with an underscore: `_var`
warning: unused variable: `unused_var`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:19
|
LL | let (mut var, unused_var) = (1, 2);
| ^^^^^^^^^^ help: consider prefixing with an underscore: `_unused_var`
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused_var`
warning: unused variable: `corridors_of_light`
--> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:26

View File

@ -2,7 +2,7 @@ error: unused variable: `y`
--> $DIR/lint-match-arms.rs:5:9
|
LL | y => (),
| ^ help: consider prefixing with an underscore: `_y`
| ^ help: if this is intentional, prefix it with an underscore: `_y`
|
note: the lint level is defined here
--> $DIR/lint-match-arms.rs:3:16

View File

@ -2,7 +2,7 @@ error: unused variable: `unused`
--> $DIR/lint-removed-allow.rs:8:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-removed-allow.rs:7:8

View File

@ -18,7 +18,7 @@ error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:12:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-removed-cmdline.rs:11:8

View File

@ -10,7 +10,7 @@ error: unused variable: `unused`
--> $DIR/lint-removed.rs:8:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-removed.rs:7:8

View File

@ -2,7 +2,7 @@ error: unused variable: `unused`
--> $DIR/lint-renamed-allow.rs:8:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-renamed-allow.rs:7:8

View File

@ -18,7 +18,7 @@ error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:8:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-renamed-cmdline.rs:7:8

View File

@ -10,7 +10,7 @@ error: unused variable: `unused`
--> $DIR/lint-renamed.rs:4:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: consider prefixing with an underscore: `_unused`
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-renamed.rs:3:8

View File

@ -2,7 +2,7 @@ error: unused variable: `a`
--> $DIR/lint-unused-variables.rs:8:5
|
LL | a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/lint-unused-variables.rs:5:9
@ -14,61 +14,61 @@ error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:14:5
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/lint-unused-variables.rs:68:9
|
LL | a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:74:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:42:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:47:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `a`
--> $DIR/lint-unused-variables.rs:22:9
|
LL | a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:29:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:34:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:55:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `b`
--> $DIR/lint-unused-variables.rs:60:9
|
LL | b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: aborting due to 11 previous errors

View File

@ -22,7 +22,7 @@ warning: unused variable: `Foo`
--> $DIR/lint-uppercase-variables.rs:22:9
|
LL | Foo => {}
| ^^^ help: consider prefixing with an underscore: `_Foo`
| ^^^ help: if this is intentional, prefix it with an underscore: `_Foo`
|
note: the lint level is defined here
--> $DIR/lint-uppercase-variables.rs:1:9
@ -35,13 +35,13 @@ warning: unused variable: `Foo`
--> $DIR/lint-uppercase-variables.rs:28:9
|
LL | let Foo = foo::Foo::Foo;
| ^^^ help: consider prefixing with an underscore: `_Foo`
| ^^^ help: if this is intentional, prefix it with an underscore: `_Foo`
warning: unused variable: `Foo`
--> $DIR/lint-uppercase-variables.rs:33:17
|
LL | fn in_param(Foo: foo::Foo) {}
| ^^^ help: consider prefixing with an underscore: `_Foo`
| ^^^ help: if this is intentional, prefix it with an underscore: `_Foo`
error: structure field `X` should have a snake case name
--> $DIR/lint-uppercase-variables.rs:10:5

View File

@ -17,7 +17,7 @@ error: unused variable: `x`
--> $DIR/liveness-unused.rs:8:7
|
LL | fn f1(x: isize) {
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
note: the lint level is defined here
--> $DIR/liveness-unused.rs:2:9
@ -29,19 +29,19 @@ error: unused variable: `x`
--> $DIR/liveness-unused.rs:12:8
|
LL | fn f1b(x: &mut isize) {
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: unused variable: `x`
--> $DIR/liveness-unused.rs:20:9
|
LL | let x: isize;
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: unused variable: `x`
--> $DIR/liveness-unused.rs:25:9
|
LL | let x = 3;
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: variable `x` is assigned to, but never used
--> $DIR/liveness-unused.rs:30:13
@ -76,25 +76,25 @@ error: unused variable: `i`
--> $DIR/liveness-unused.rs:59:12
|
LL | Some(i) => {
| ^ help: consider prefixing with an underscore: `_i`
| ^ help: if this is intentional, prefix it with an underscore: `_i`
error: unused variable: `x`
--> $DIR/liveness-unused.rs:79:9
|
LL | for x in 1..10 { }
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: unused variable: `x`
--> $DIR/liveness-unused.rs:84:10
|
LL | for (x, _) in [1, 2, 3].iter().enumerate() { }
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: unused variable: `x`
--> $DIR/liveness-unused.rs:89:13
|
LL | for (_, x) in [1, 2, 3].iter().enumerate() {
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: variable `x` is assigned to, but never used
--> $DIR/liveness-unused.rs:112:9

View File

@ -25,7 +25,7 @@ warning: unused variable: `x`
--> $DIR/never-assign-dead-code.rs:9:9
|
LL | let x: ! = panic!("aah");
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
note: the lint level is defined here
--> $DIR/never-assign-dead-code.rs:6:9

View File

@ -2,7 +2,7 @@ warning: unused variable: `a`
--> $DIR/attributes-included.rs:17:9
|
LL | let a: i32 = "foo";
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/attributes-included.rs:4:9

View File

@ -2,7 +2,7 @@ error: unused variable: `a`
--> $DIR/param-attrs-cfg.rs:24:23
|
LL | #[cfg(something)] a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/param-attrs-cfg.rs:5:9
@ -14,109 +14,109 @@ error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:30:23
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:32:40
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `a`
--> $DIR/param-attrs-cfg.rs:107:27
|
LL | #[cfg(something)] a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:113:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:115:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:67:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:69:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:75:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:77:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `a`
--> $DIR/param-attrs-cfg.rs:41:27
|
LL | #[cfg(something)] a: i32,
| ^ help: consider prefixing with an underscore: `_a`
| ^ help: if this is intentional, prefix it with an underscore: `_a`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:48:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:50:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:56:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:58:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:86:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:88:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: unused variable: `b`
--> $DIR/param-attrs-cfg.rs:94:27
|
LL | #[cfg(something)] b: i32,
| ^ help: consider prefixing with an underscore: `_b`
| ^ help: if this is intentional, prefix it with an underscore: `_b`
error: unused variable: `c`
--> $DIR/param-attrs-cfg.rs:96:44
|
LL | #[cfg_attr(nothing, cfg(nothing))] c: i32,
| ^ help: consider prefixing with an underscore: `_c`
| ^ help: if this is intentional, prefix it with an underscore: `_c`
error: aborting due to 19 previous errors

View File

@ -2,7 +2,7 @@ warning: unused variable: `theOtherTwo`
--> $DIR/issue-24690.rs:13:9
|
LL | let theOtherTwo = 2;
| ^^^^^^^^^^^ help: consider prefixing with an underscore: `_theOtherTwo`
| ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_theOtherTwo`
|
note: the lint level is defined here
--> $DIR/issue-24690.rs:8:9

View File

@ -14,7 +14,7 @@ error: unused variable: `x`
--> $DIR/unused-closure-argument.rs:17:15
|
LL | .map(|x| 4)
| ^ help: consider prefixing with an underscore: `_x`
| ^ help: if this is intentional, prefix it with an underscore: `_x`
error: aborting due to 2 previous errors