]> git.lizzy.rs Git - rust.git/blob - src/docs/rest_pat_in_fully_bound_structs.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / rest_pat_in_fully_bound_structs.txt
1 ### What it does
2 Checks for unnecessary '..' pattern binding on struct when all fields are explicitly matched.
3
4 ### Why is this bad?
5 Correctness and readability. It's like having a wildcard pattern after
6 matching all enum variants explicitly.
7
8 ### Example
9 ```
10 let a = A { a: 5 };
11
12 match a {
13     A { a: 5, .. } => {},
14     _ => {},
15 }
16 ```
17
18 Use instead:
19 ```
20 match a {
21     A { a: 5 } => {},
22     _ => {},
23 }
24 ```