aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamrk <[email protected]>2020-02-17 10:53:12 +0000
committeradamrk <[email protected]>2020-02-17 10:53:12 +0000
commit0e260aa6b15d9dc8c067adb05f3774aec3fb66ec (patch)
treeb594a24ec38d69d85168708e94e272e0509a3335
parente88eb89132d2407614aebee1b43472b577a2394c (diff)
use 'if let' instead of match on kind in lower.rs
-rw-r--r--crates/ra_hir_ty/src/lower.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs
index a5b2734a0..c2a3703fa 100644
--- a/crates/ra_hir_ty/src/lower.rs
+++ b/crates/ra_hir_ty/src/lower.rs
@@ -806,9 +806,8 @@ fn fn_sig_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> PolyFn
806/// Build the type of a tuple struct constructor. 806/// Build the type of a tuple struct constructor.
807fn type_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> Binders<Ty> { 807fn type_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> Binders<Ty> {
808 let struct_data = db.struct_data(def.into()); 808 let struct_data = db.struct_data(def.into());
809 match struct_data.variant_data.kind() { 809 if let StructKind::Unit = struct_data.variant_data.kind() {
810 StructKind::Unit => return type_for_adt(db, def.into()), 810 return type_for_adt(db, def.into());
811 StructKind::Tuple | StructKind::Record => (),
812 } 811 }
813 let generics = generics(db, def.into()); 812 let generics = generics(db, def.into());
814 let substs = Substs::bound_vars(&generics); 813 let substs = Substs::bound_vars(&generics);
@@ -832,9 +831,8 @@ fn fn_sig_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId
832fn type_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId) -> Binders<Ty> { 831fn type_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId) -> Binders<Ty> {
833 let enum_data = db.enum_data(def.parent); 832 let enum_data = db.enum_data(def.parent);
834 let var_data = &enum_data.variants[def.local_id].variant_data; 833 let var_data = &enum_data.variants[def.local_id].variant_data;
835 match var_data.kind() { 834 if let StructKind::Unit = var_data.kind() {
836 StructKind::Unit => return type_for_adt(db, def.parent.into()), 835 return type_for_adt(db, def.parent.into());
837 StructKind::Record | StructKind::Tuple => (),
838 } 836 }
839 let generics = generics(db, def.parent.into()); 837 let generics = generics(db, def.parent.into());
840 let substs = Substs::bound_vars(&generics); 838 let substs = Substs::bound_vars(&generics);