]> git.proxmox.com Git - rustc.git/blame - src/test/ui/suggestions/try-removing-the-field.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / suggestions / try-removing-the-field.rs
CommitLineData
f2b60f7d
FG
1// run-pass
2
3#![allow(dead_code)]
4
5struct Foo {
6 foo: i32,
7 bar: (),
8 baz: (),
9}
10
11fn use_foo(x: Foo) -> i32 {
12 let Foo { foo, bar, .. } = x; //~ WARNING unused variable: `bar`
13 //~| help: try removing the field
14 return foo;
15}
16
487cf647
FG
17// issue #105028, suggest removing the field only for shorthand
18fn use_match(x: Foo) {
19 match x {
20 Foo { foo: unused, .. } => { //~ WARNING unused variable
21 //~| help: if this is intentional, prefix it with an underscore
22 }
23 }
24
25 match x {
26 Foo { foo, .. } => { //~ WARNING unused variable
27 //~| help: try removing the field
28 }
29 }
30}
31
f2b60f7d 32fn main() {}