Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/diagnostics/match_check/usefulness.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/match_check/usefulness.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs
index 088c0b0586..b5d238116f 100644
--- a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs
+++ b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs
@@ -686,17 +686,17 @@ impl SubPatSet {
SubPatSet::Empty => panic!("bug"),
SubPatSet::Full => {}
SubPatSet::Seq { subpats } => {
- for (_, sub_set) in subpats {
+ for sub_set in subpats.values() {
fill_subpats(sub_set, unreachable_pats, cx);
}
}
SubPatSet::Alt { subpats, pat, alt_count, .. } => {
let expanded = pat.expand_or_pat(cx);
- for i in 0..*alt_count {
+ for (i, &expanded) in expanded.iter().enumerate().take(*alt_count) {
let sub_set = subpats.get(&i).unwrap_or(&SubPatSet::Empty);
if sub_set.is_empty() {
// Found an unreachable subpattern.
- unreachable_pats.push(expanded[i]);
+ unreachable_pats.push(expanded);
} else {
fill_subpats(sub_set, unreachable_pats, cx);
}