]> git.lizzy.rs Git - rust.git/blob - tests/ui/unneeded_field_pattern.rs
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / unneeded_field_pattern.rs
1
2
3
4 #![warn(unneeded_field_pattern)]
5 #[allow(dead_code, unused)]
6
7 struct Foo {
8     a: i32,
9     b: i32,
10     c: i32,
11 }
12
13 fn main() {
14     let f = Foo { a: 0, b: 0, c: 0 };
15
16     match f {
17         Foo { a: _, b: 0, .. } => {}
18
19         Foo { a: _, b: _, c: _ } => {}
20
21     }
22     match f {
23         Foo { b: 0, .. } => {} // should be OK
24         Foo { .. } => {} // and the Force might be with this one
25     }
26 }