]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/rest_pat_in_fully_bound_structs.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / rest_pat_in_fully_bound_structs.rs
CommitLineData
f20569fa
XL
1#![warn(clippy::rest_pat_in_fully_bound_structs)]
2
3struct A {
4 a: i32,
5 b: i64,
6 c: &'static str,
7}
8
9macro_rules! foo {
10 ($param:expr) => {
11 match $param {
12 A { a: 0, b: 0, c: "", .. } => {},
13 _ => {},
14 }
15 };
16}
17
18fn 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}