Auto merge of #88271 - sexxi-goose:liveness, r=nikomatsakis
2229: Consider varaiables mentioned in closure as used Fixes: https://github.com/rust-lang/project-rfc-2229/issues/57 r? `@nikomatsakis`
This commit is contained in:
commit
faa0a10406
5 changed files with 10 additions and 63 deletions
|
|
@ -8,7 +8,7 @@ struct Props {
|
|||
|
||||
fn main() {
|
||||
// Test 1
|
||||
let props_2 = Props { //~ WARNING: unused variable: `props_2`
|
||||
let props_2 = Props {
|
||||
field_1: 1,
|
||||
field_2: 1,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,3 @@
|
|||
warning: unused variable: `props_2`
|
||||
--> $DIR/issue-87987.rs:11:9
|
||||
|
|
||||
LL | let props_2 = Props {
|
||||
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_props_2`
|
||||
|
|
||||
= note: `#[warn(unused_variables)]` on by default
|
||||
|
||||
warning: field is never read: `field_1`
|
||||
--> $DIR/issue-87987.rs:5:5
|
||||
|
|
||||
|
|
@ -20,5 +12,5 @@ warning: field is never read: `field_2`
|
|||
LL | field_2: u32,
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: 3 warnings emitted
|
||||
warning: 2 warnings emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ fn test3() {
|
|||
|
||||
fn test4() {
|
||||
let t = (String::from("Hello"), String::from("World"));
|
||||
//~^ WARN unused variable: `t`
|
||||
|
||||
let c = || {
|
||||
let (_, _) = t;
|
||||
|
|
@ -81,9 +80,7 @@ fn test7() {
|
|||
|
||||
fn test8() {
|
||||
let x = 0;
|
||||
//~^ WARN unused variable: `x`
|
||||
let tup = (1, 2);
|
||||
//~^ WARN unused variable: `tup`
|
||||
let p = Point { x: 10, y: 20 };
|
||||
|
||||
let c = || {
|
||||
|
|
|
|||
|
|
@ -29,29 +29,11 @@ warning: unused variable: `t2`
|
|||
LL | let (_, t2) = t;
|
||||
| ^^ help: if this is intentional, prefix it with an underscore: `_t2`
|
||||
|
||||
warning: unused variable: `t`
|
||||
--> $DIR/destructure_patterns.rs:45:9
|
||||
|
|
||||
LL | let t = (String::from("Hello"), String::from("World"));
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_t`
|
||||
|
||||
warning: unused variable: `x`
|
||||
--> $DIR/destructure_patterns.rs:91:21
|
||||
--> $DIR/destructure_patterns.rs:88:21
|
||||
|
|
||||
LL | let Point { x, y } = p;
|
||||
| ^ help: try ignoring the field: `x: _`
|
||||
|
||||
warning: unused variable: `x`
|
||||
--> $DIR/destructure_patterns.rs:83:9
|
||||
|
|
||||
LL | let x = 0;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
||||
warning: unused variable: `tup`
|
||||
--> $DIR/destructure_patterns.rs:85:9
|
||||
|
|
||||
LL | let tup = (1, 2);
|
||||
| ^^^ help: if this is intentional, prefix it with an underscore: `_tup`
|
||||
|
||||
warning: 8 warnings emitted
|
||||
warning: 5 warnings emitted
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue