Newtype destructures test for record that decay into their only arg

This commit is contained in:
Ayaz Hafiz 2022-07-21 15:03:18 -04:00
parent 929a00e73d
commit f3722659fc
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 26 additions and 2 deletions

View file

@ -985,9 +985,13 @@ fn needs_tests(pattern: &Pattern) -> bool {
// read the appropriate argument in the struct when constructing the decision tree.
arguments.len() != 1
}
RecordDestructure(arguments, _) => {
// Same logic as for newtype destructures - records with one argument decay into their
// argument.
arguments.len() != 1
}
RecordDestructure(_, _)
| AppliedTag { .. }
AppliedTag { .. }
| OpaqueUnwrap { .. }
| BitLiteral { .. }
| EnumLiteral { .. }