Correct what destructures are exhaustive

This commit is contained in:
Ayaz Hafiz 2023-04-10 15:43:02 -05:00
parent 4f48873178
commit f0b017b807
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -140,7 +140,7 @@ impl Pattern {
RecordDestructure { destructs, .. } => {
// If all destructs are surely exhaustive, then this is surely exhaustive.
destructs.iter().all(|d| match &d.value.typ {
DestructType::Required | DestructType::Optional(_, _) => false,
DestructType::Required | DestructType::Optional(_, _) => true,
DestructType::Guard(_, pat) => pat.value.surely_exhaustive(),
})
}