]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/src/docs/unneeded_field_pattern.txt
New upstream version 1.65.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / unneeded_field_pattern.txt
1 ### What it does
2 Checks for structure field patterns bound to wildcards.
3
4 ### Why is this bad?
5 Using `..` instead is shorter and leaves the focus on
6 the fields that are actually bound.
7
8 ### Example
9 ```
10 let f = Foo { a: 0, b: 0, c: 0 };
11
12 match f {
13 Foo { a: _, b: 0, .. } => {},
14 Foo { a: _, b: _, c: _ } => {},
15 }
16 ```
17
18 Use instead:
19 ```
20 let f = Foo { a: 0, b: 0, c: 0 };
21
22 match f {
23 Foo { b: 0, .. } => {},
24 Foo { .. } => {},
25 }
26 ```