aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
committerLukas Wirth <[email protected]>2021-06-17 16:37:14 +0100
commit95c8c65139c10e4de44367fead8dff88511e6d46 (patch)
tree4326d46ee282c133123f3a08aaee7d640f007050 /crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
parentc82a9141abe6b6cbf5b55710dc8a315a3839081b (diff)
Nest all the or-patterns!
Diffstat (limited to 'crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
index 471cd4921..e3d640a79 100644
--- a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
+++ b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
@@ -84,10 +84,7 @@ impl IntRange {
84 #[inline] 84 #[inline]
85 fn is_integral(ty: &Ty) -> bool { 85 fn is_integral(ty: &Ty) -> bool {
86 match ty.kind(&Interner) { 86 match ty.kind(&Interner) {
87 TyKind::Scalar(Scalar::Char) 87 TyKind::Scalar(Scalar::Char | Scalar::Int(_) | Scalar::Uint(_) | Scalar::Bool) => true,
88 | TyKind::Scalar(Scalar::Int(_))
89 | TyKind::Scalar(Scalar::Uint(_))
90 | TyKind::Scalar(Scalar::Bool) => true,
91 _ => false, 88 _ => false,
92 } 89 }
93 } 90 }
@@ -381,7 +378,7 @@ impl Constructor {
381 // Wildcards cover anything 378 // Wildcards cover anything
382 (_, Wildcard) => true, 379 (_, Wildcard) => true,
383 // The missing ctors are not covered by anything in the matrix except wildcards. 380 // The missing ctors are not covered by anything in the matrix except wildcards.
384 (Missing, _) | (Wildcard, _) => false, 381 (Missing | Wildcard, _) => false,
385 382
386 (Single, Single) => true, 383 (Single, Single) => true,
387 (Variant(self_id), Variant(other_id)) => self_id == other_id, 384 (Variant(self_id), Variant(other_id)) => self_id == other_id,
@@ -523,7 +520,7 @@ impl SplitWildcard {
523 } 520 }
524 } 521 }
525 TyKind::Scalar(Scalar::Char) => unhandled(), 522 TyKind::Scalar(Scalar::Char) => unhandled(),
526 TyKind::Scalar(Scalar::Int(..)) | TyKind::Scalar(Scalar::Uint(..)) => unhandled(), 523 TyKind::Scalar(Scalar::Int(..) | Scalar::Uint(..)) => unhandled(),
527 TyKind::Never if !cx.feature_exhaustive_patterns() && !pcx.is_top_level => { 524 TyKind::Never if !cx.feature_exhaustive_patterns() && !pcx.is_top_level => {
528 smallvec![NonExhaustive] 525 smallvec![NonExhaustive]
529 } 526 }