aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 17:22:32 +0100
committerGitHub <[email protected]>2021-06-17 17:22:32 +0100
commitce926aebc4461e38535047958c0b6f72b7a0c0ea (patch)
tree4b844e0681b459836bac22c34bee43e4dfa3dc5f /crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs
parent3ae0c5911ab50ee209179ee4329b0551abe6fc48 (diff)
parent02d25ab60d2701ce71fe2dfaca36627ad902e229 (diff)
Merge #9315
9315: Nest all the or-patterns! r=Veykril a=Veykril `cargo +nightly clippy --fix -Z unstable-options --allow-dirty -- -A clippy::all -D clippy::unnested_or_patterns` Co-authored-by: Lukas Wirth <[email protected]>
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 }