aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-06-28 02:02:03 +0100
committerVeetaha <[email protected]>2020-06-28 02:03:59 +0100
commite75e2ae5b6b6b1364368ceb3d4081b6508b2f001 (patch)
treee88a9920a908bfdf66c156ab582ce90d77d55c2f /crates/ra_hir_ty
parent513924a7e01ef81a03869249c902daf148439736 (diff)
Simlify with matches!()
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs6
-rw-r--r--crates/ra_hir_ty/src/lib.rs10
2 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 61af5f064..22884522a 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -785,11 +785,7 @@ impl<'a> InferenceContext<'a> {
785 for &check_closures in &[false, true] { 785 for &check_closures in &[false, true] {
786 let param_iter = param_tys.iter().cloned().chain(repeat(Ty::Unknown)); 786 let param_iter = param_tys.iter().cloned().chain(repeat(Ty::Unknown));
787 for (&arg, param_ty) in args.iter().zip(param_iter) { 787 for (&arg, param_ty) in args.iter().zip(param_iter) {
788 let is_closure = match &self.body[arg] { 788 let is_closure = matches!(&self.body[arg], Expr::Lambda { .. });
789 Expr::Lambda { .. } => true,
790 _ => false,
791 };
792
793 if is_closure != check_closures { 789 if is_closure != check_closures {
794 continue; 790 continue;
795 } 791 }
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 414158139..c9513b752 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -620,17 +620,11 @@ pub enum GenericPredicate {
620 620
621impl GenericPredicate { 621impl GenericPredicate {
622 pub fn is_error(&self) -> bool { 622 pub fn is_error(&self) -> bool {
623 match self { 623 matches!(self, GenericPredicate::Error)
624 GenericPredicate::Error => true,
625 _ => false,
626 }
627 } 624 }
628 625
629 pub fn is_implemented(&self) -> bool { 626 pub fn is_implemented(&self) -> bool {
630 match self { 627 matches!(self, GenericPredicate::Implemented(_))
631 GenericPredicate::Implemented(_) => true,
632 _ => false,
633 }
634 } 628 }
635 629
636 pub fn trait_ref(&self, db: &dyn HirDatabase) -> Option<TraitRef> { 630 pub fn trait_ref(&self, db: &dyn HirDatabase) -> Option<TraitRef> {