From c83467796b6c7365ea4f41900d74444384a9e618 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:17:28 +0200 Subject: Finalize Trait grammar --- crates/ra_hir/src/has_source.rs | 6 +++--- crates/ra_hir/src/semantics.rs | 2 +- crates/ra_hir/src/semantics/source_to_def.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 9581552e5..057f6e32f 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs @@ -99,8 +99,8 @@ impl HasSource for Static { } } impl HasSource for Trait { - type Ast = ast::TraitDef; - fn source(self, db: &dyn HirDatabase) -> InFile { + type Ast = ast::Trait; + fn source(self, db: &dyn HirDatabase) -> InFile { self.id.lookup(db.upcast()).source(db.upcast()) } } @@ -127,7 +127,7 @@ impl HasSource for ImplDef { } impl HasSource for TypeParam { - type Ast = Either; + type Ast = Either; fn source(self, db: &dyn HirDatabase) -> InFile { let child_source = self.id.parent.child_source(db.upcast()); child_source.map(|it| it[self.id.local_id].clone()) diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 32a60b789..5f5104dab 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -583,7 +583,7 @@ to_def_impls![ (crate::Struct, ast::Struct, struct_to_def), (crate::Enum, ast::Enum, enum_to_def), (crate::Union, ast::Union, union_to_def), - (crate::Trait, ast::TraitDef, trait_to_def), + (crate::Trait, ast::Trait, trait_to_def), (crate::ImplDef, ast::ImplDef, impl_to_def), (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), (crate::Const, ast::Const, const_to_def), diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 782a03f9e..ae41d3ddf 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -65,7 +65,7 @@ impl SourceToDefCtx<'_, '_> { Some(ModuleId { krate: parent_module.krate, local_id: child_id }) } - pub(super) fn trait_to_def(&mut self, src: InFile) -> Option { + pub(super) fn trait_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::TRAIT) } pub(super) fn impl_to_def(&mut self, src: InFile) -> Option { @@ -154,7 +154,7 @@ impl SourceToDefCtx<'_, '_> { let def = self.module_to_def(container.with_value(it))?; def.into() }, - ast::TraitDef(it) => { + ast::Trait(it) => { let def = self.trait_to_def(container.with_value(it))?; def.into() }, @@ -207,7 +207,7 @@ impl SourceToDefCtx<'_, '_> { ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), - ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), + ast::Trait(it) => self.trait_to_def(container.with_value(it))?.into(), ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), _ => continue, -- cgit v1.2.3