From 0e260aa6b15d9dc8c067adb05f3774aec3fb66ec Mon Sep 17 00:00:00 2001 From: adamrk Date: Mon, 17 Feb 2020 11:53:12 +0100 Subject: use 'if let' instead of match on kind in lower.rs --- crates/ra_hir_ty/src/lower.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir_ty') 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 /// Build the type of a tuple struct constructor. fn type_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> Binders { let struct_data = db.struct_data(def.into()); - match struct_data.variant_data.kind() { - StructKind::Unit => return type_for_adt(db, def.into()), - StructKind::Tuple | StructKind::Record => (), + if let StructKind::Unit = struct_data.variant_data.kind() { + return type_for_adt(db, def.into()); } let generics = generics(db, def.into()); let substs = Substs::bound_vars(&generics); @@ -832,9 +831,8 @@ fn fn_sig_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId fn type_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId) -> Binders { let enum_data = db.enum_data(def.parent); let var_data = &enum_data.variants[def.local_id].variant_data; - match var_data.kind() { - StructKind::Unit => return type_for_adt(db, def.parent.into()), - StructKind::Record | StructKind::Tuple => (), + if let StructKind::Unit = var_data.kind() { + return type_for_adt(db, def.parent.into()); } let generics = generics(db, def.parent.into()); let substs = Substs::bound_vars(&generics); -- cgit v1.2.3