From eceaf94f1936436e33ae235ca65bf2a6d4f77da5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 18 Feb 2020 15:32:19 +0200 Subject: More manual clippy fixes --- crates/ra_hir/src/code_model.rs | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'crates/ra_hir/src/code_model.rs') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index fe9149c9d..1bdcda069 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -988,20 +988,17 @@ impl Type { pub fn fields(&self, db: &impl HirDatabase) -> Vec<(StructField, Type)> { if let Ty::Apply(a_ty) = &self.ty.value { - match a_ty.ctor { - TypeCtor::Adt(AdtId::StructId(s)) => { - let var_def = s.into(); - return db - .field_types(var_def) - .iter() - .map(|(local_id, ty)| { - let def = StructField { parent: var_def.into(), id: local_id }; - let ty = ty.clone().subst(&a_ty.parameters); - (def, self.derived(ty)) - }) - .collect(); - } - _ => {} + if let TypeCtor::Adt(AdtId::StructId(s)) = a_ty.ctor { + let var_def = s.into(); + return db + .field_types(var_def) + .iter() + .map(|(local_id, ty)| { + let def = StructField { parent: var_def.into(), id: local_id }; + let ty = ty.clone().subst(&a_ty.parameters); + (def, self.derived(ty)) + }) + .collect(); } }; Vec::new() @@ -1010,14 +1007,11 @@ impl Type { pub fn tuple_fields(&self, _db: &impl HirDatabase) -> Vec { let mut res = Vec::new(); if let Ty::Apply(a_ty) = &self.ty.value { - match a_ty.ctor { - TypeCtor::Tuple { .. } => { - for ty in a_ty.parameters.iter() { - let ty = ty.clone(); - res.push(self.derived(ty)); - } + if let TypeCtor::Tuple { .. } = a_ty.ctor { + for ty in a_ty.parameters.iter() { + let ty = ty.clone(); + res.push(self.derived(ty)); } - _ => {} } }; res -- cgit v1.2.3