]> git.lizzy.rs Git - rust.git/commitdiff
internal: normalize name
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 30 Apr 2021 08:52:31 +0000 (11:52 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 30 Apr 2021 08:52:31 +0000 (11:52 +0300)
All def types in hir are unsubstituted

crates/hir/src/display.rs
crates/hir/src/lib.rs
crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs
crates/ide_completion/src/context.rs
crates/ide_completion/src/render/enum_variant.rs

index 01a4d205fd6a5c9e107505cdce1c0cd2e5def856..508ac37c22a6a4eaec5fe1db5ec3ba92cc0a6396 100644 (file)
@@ -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)
     }
 }
 
index 0acfa582a0bc6ead1edcb939c250b7368e54e139..9eb7672daf20d762a3dc0737f05f3c116d275897 100644 (file)
@@ -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(),
index c13c6eebe8845083b4851b931ccb44cf90010b2e..ce6998d82878f6e1d99d114f6777e2a284829d95 100644 (file)
@@ -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(())
index 32f81aec14abf0154ddb2bcdd43d6775b922e3fb..b005bd7736dd50fa31e463e527b4d05928174039 100644 (file)
@@ -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))
index 832f5ced1310fa146ba41616f7828b0013872c9b..0c0c71134a862e154be0a1df9a8ec495435fbe01 100644 (file)
@@ -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!(