]> git.lizzy.rs Git - rust.git/blob - tests/ui/rest_pat_in_fully_bound_structs.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[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 macro_rules! foo {
10     ($param:expr) => {
11         match $param {
12             A { a: 0, b: 0, c: "", .. } => {},
13             _ => {},
14         }
15     };
16 }
17
18 fn main() {
19     let a_struct = A { a: 5, b: 42, c: "A" };
20
21     match a_struct {
22         A { a: 5, b: 42, c: "", .. } => {}, // Lint
23         A { a: 0, b: 0, c: "", .. } => {},  // Lint
24         _ => {},
25     }
26
27     match a_struct {
28         A { a: 5, b: 42, .. } => {},
29         A { a: 0, b: 0, c: "", .. } => {}, // Lint
30         _ => {},
31     }
32
33     // No lint
34     match a_struct {
35         A { a: 5, .. } => {},
36         A { a: 0, b: 0, .. } => {},
37         _ => {},
38     }
39
40     // No lint
41     foo!(a_struct);
42 }