]> git.lizzy.rs Git - rust.git/blob - tests/ui/rest_pat_in_fully_bound_structs.rs
Auto merge of #5258 - ThibsG:UselessBindingInStruct638, r=flip1995
[rust.git] / tests / ui / rest_pat_in_fully_bound_structs.rs
1 #![warn(clippy::rest_pat_in_fully_bound_structs)]
2
3 struct A {
4     a: i32,
5     b: i64,
6     c: &'static str,
7 }
8
9 fn main() {
10     let a_struct = A { a: 5, b: 42, c: "A" };
11
12     match a_struct {
13         A { a: 5, b: 42, c: "", .. } => {}, // Lint
14         A { a: 0, b: 0, c: "", .. } => {},  // Lint
15         _ => {},
16     }
17
18     match a_struct {
19         A { a: 5, b: 42, .. } => {},
20         A { a: 0, b: 0, c: "", .. } => {}, // Lint
21         _ => {},
22     }
23
24     // No lint
25     match a_struct {
26         A { a: 5, .. } => {},
27         A { a: 0, b: 0, .. } => {},
28         _ => {},
29     }
30 }