Skip to content

Commit cb3ef55

Browse files
committed
internal: normalize name
All def types in hir are unsubstituted
1 parent 49b219b commit cb3ef55

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

crates/hir/src/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl HirDisplay for Field {
170170
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
171171
write_visibility(self.parent.module(f.db).id, self.visibility(f.db), f)?;
172172
write!(f, "{}: ", self.name(f.db))?;
173-
self.signature_ty(f.db).hir_fmt(f)
173+
self.ty(f.db).hir_fmt(f)
174174
}
175175
}
176176

crates/hir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl Field {
509509
/// placeholder types for type parameters). This is good for showing
510510
/// signature help, but not so good to actually get the type of the field
511511
/// when you actually have a variable of the struct.
512-
pub fn signature_ty(&self, db: &dyn HirDatabase) -> Type {
512+
pub fn ty(&self, db: &dyn HirDatabase) -> Type {
513513
let var_id = self.parent.into();
514514
let generic_def_id: GenericDefId = match self.parent {
515515
VariantDef::Struct(it) => it.id.into(),

crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn existing_from_impl(
9191

9292
let enum_type = enum_.ty(sema.db);
9393

94-
let wrapped_type = variant.fields(sema.db).get(0)?.signature_ty(sema.db);
94+
let wrapped_type = variant.fields(sema.db).get(0)?.ty(sema.db);
9595

9696
if enum_type.impls_trait(sema.db, from_trait, &[wrapped_type]) {
9797
Some(())

crates/ide_completion/src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'a> CompletionContext<'a> {
347347
.and_then(|node| ast::RecordExprField::cast(node))
348348
.and_then(|rf| self.sema.resolve_record_field(&rf).zip(Some(rf)))
349349
.map(|(f, rf)|(
350-
Some(f.0.signature_ty(self.db)),
350+
Some(f.0.ty(self.db)),
351351
rf.field_name().map(NameOrNameRef::NameRef),
352352
))
353353
.unwrap_or((None, None))
@@ -357,7 +357,7 @@ impl<'a> CompletionContext<'a> {
357357
self.sema
358358
.resolve_record_field(&it)
359359
.map(|f|(
360-
Some(f.0.signature_ty(self.db)),
360+
Some(f.0.ty(self.db)),
361361
it.field_name().map(NameOrNameRef::NameRef),
362362
))
363363
.unwrap_or((None, None))

crates/ide_completion/src/render/enum_variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a> EnumRender<'a> {
9393
.variant
9494
.fields(self.ctx.db())
9595
.into_iter()
96-
.map(|field| (field.name(self.ctx.db()), field.signature_ty(self.ctx.db())));
96+
.map(|field| (field.name(self.ctx.db()), field.ty(self.ctx.db())));
9797

9898
match self.variant_kind {
9999
StructKind::Tuple | StructKind::Unit => format!(

0 commit comments

Comments
 (0)