diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index 01a4d205fd6..508ac37c22a 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs @@ -170,7 +170,7 @@ impl HirDisplay for Field { fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { write_visibility(self.parent.module(f.db).id, self.visibility(f.db), f)?; write!(f, "{}: ", self.name(f.db))?; - self.signature_ty(f.db).hir_fmt(f) + self.ty(f.db).hir_fmt(f) } } diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 0acfa582a0b..9eb7672daf2 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -509,7 +509,7 @@ pub fn name(&self, db: &dyn HirDatabase) -> Name { /// placeholder types for type parameters). This is good for showing /// signature help, but not so good to actually get the type of the field /// when you actually have a variable of the struct. - pub fn signature_ty(&self, db: &dyn HirDatabase) -> Type { + pub fn ty(&self, db: &dyn HirDatabase) -> Type { let var_id = self.parent.into(); let generic_def_id: GenericDefId = match self.parent { VariantDef::Struct(it) => it.id.into(), diff --git a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs index c13c6eebe88..ce6998d8287 100644 --- a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs @@ -91,7 +91,7 @@ fn existing_from_impl( let enum_type = enum_.ty(sema.db); - let wrapped_type = variant.fields(sema.db).get(0)?.signature_ty(sema.db); + let wrapped_type = variant.fields(sema.db).get(0)?.ty(sema.db); if enum_type.impls_trait(sema.db, from_trait, &[wrapped_type]) { Some(()) diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index 32f81aec14a..b005bd7736d 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs @@ -347,7 +347,7 @@ fn fill( .and_then(|node| ast::RecordExprField::cast(node)) .and_then(|rf| self.sema.resolve_record_field(&rf).zip(Some(rf))) .map(|(f, rf)|( - Some(f.0.signature_ty(self.db)), + Some(f.0.ty(self.db)), rf.field_name().map(NameOrNameRef::NameRef), )) .unwrap_or((None, None)) @@ -357,7 +357,7 @@ fn fill( self.sema .resolve_record_field(&it) .map(|f|( - Some(f.0.signature_ty(self.db)), + Some(f.0.ty(self.db)), it.field_name().map(NameOrNameRef::NameRef), )) .unwrap_or((None, None)) diff --git a/crates/ide_completion/src/render/enum_variant.rs b/crates/ide_completion/src/render/enum_variant.rs index 832f5ced131..0c0c71134a8 100644 --- a/crates/ide_completion/src/render/enum_variant.rs +++ b/crates/ide_completion/src/render/enum_variant.rs @@ -93,7 +93,7 @@ fn detail(&self) -> String { .variant .fields(self.ctx.db()) .into_iter() - .map(|field| (field.name(self.ctx.db()), field.signature_ty(self.ctx.db()))); + .map(|field| (field.name(self.ctx.db()), field.ty(self.ctx.db()))); match self.variant_kind { StructKind::Tuple | StructKind::Unit => format!(