]> git.lizzy.rs Git - rust.git/commit
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)
commitcbbdf998edc905bcf44ba212f068114b3a62f858
treebc16a74fee61bf9eeaedb96eb2dcce767e957496
parent30c990b69354f9bfb1d7851da931bce2d1efe087
parent2eb8343af18470d3c48a50c68dbaeb1887b42c37
Rollup merge of #50327 - varkor:match-unused-struct-field, r=estebank

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