]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #50327 - varkor:match-unused-struct-field, r=estebank
authorkennytm <kennytm@gmail.com>
Mon, 30 Apr 2018 17:18:40 +0000 (01:18 +0800)
committerGitHub <noreply@github.com>
Mon, 30 Apr 2018 17:18:40 +0000 (01:18 +0800)
Display correct unused field suggestion for nested struct patterns

Extends https://github.com/rust-lang/rust/pull/47922 by checking more sophisticated patterns (e.g. references, slices, etc.).
Before:
```
warning: unused variable: `bar`
  --> src/main.rs:37:21
   |
37 |         &Foo::Bar { bar } => true,
   |                     ^^^ help: consider using `_bar` instead
   |
   = note: #[warn(unused_variables)] on by default
```
After:
```
warning: unused variable: `bar`
  --> src/main.rs:37:21
   |
37 |         &Foo::Bar { bar } => true,
   |                     ^^^ help: try ignoring the field: `bar: _`
   |
   = note: #[warn(unused_variables)] on by default
```

Fixes #50303.

r? @estebank


Trivial merge