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_syntax/src/ast/generated/nodes.rs | 32 ++++++++++++++--------------- crates/ra_syntax/src/ast/node_ext.rs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 00a70fce0..3adb6b2d4 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -169,15 +169,15 @@ impl Struct { pub fn field_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TraitDef { +pub struct Trait { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for TraitDef {} -impl ast::NameOwner for TraitDef {} -impl ast::VisibilityOwner for TraitDef {} -impl ast::GenericParamsOwner for TraitDef {} -impl ast::TypeBoundsOwner for TraitDef {} -impl TraitDef { +impl ast::AttrsOwner for Trait {} +impl ast::NameOwner for Trait {} +impl ast::VisibilityOwner for Trait {} +impl ast::GenericParamsOwner for Trait {} +impl ast::TypeBoundsOwner for Trait {} +impl Trait { pub fn unsafe_token(&self) -> Option { support::token(&self.syntax, T![unsafe]) } pub fn auto_token(&self) -> Option { support::token(&self.syntax, T![auto]) } pub fn trait_token(&self) -> Option { support::token(&self.syntax, T![trait]) } @@ -1283,7 +1283,7 @@ pub enum Item { Module(Module), Static(Static), Struct(Struct), - TraitDef(TraitDef), + Trait(Trait), TypeAlias(TypeAlias), Union(Union), Use(Use), @@ -1532,8 +1532,8 @@ impl AstNode for Struct { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TraitDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } +impl AstNode for Trait { + fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2805,8 +2805,8 @@ impl From for Item { impl From for Item { fn from(node: Struct) -> Item { Item::Struct(node) } } -impl From for Item { - fn from(node: TraitDef) -> Item { Item::TraitDef(node) } +impl From for Item { + fn from(node: Trait) -> Item { Item::Trait(node) } } impl From for Item { fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } @@ -2821,7 +2821,7 @@ impl AstNode for Item { fn can_cast(kind: SyntaxKind) -> bool { match kind { CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE - | STATIC | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, + | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true, _ => false, } } @@ -2837,7 +2837,7 @@ impl AstNode for Item { MODULE => Item::Module(Module { syntax }), STATIC => Item::Static(Static { syntax }), STRUCT => Item::Struct(Struct { syntax }), - TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), + TRAIT => Item::Trait(Trait { syntax }), TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), UNION => Item::Union(Union { syntax }), USE => Item::Use(Use { syntax }), @@ -2857,7 +2857,7 @@ impl AstNode for Item { Item::Module(it) => &it.syntax, Item::Static(it) => &it.syntax, Item::Struct(it) => &it.syntax, - Item::TraitDef(it) => &it.syntax, + Item::Trait(it) => &it.syntax, Item::TypeAlias(it) => &it.syntax, Item::Union(it) => &it.syntax, Item::Use(it) => &it.syntax, @@ -3516,7 +3516,7 @@ impl std::fmt::Display for Struct { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TraitDef { +impl std::fmt::Display for Trait { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 4da1d5c11..a8d8955de 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -481,7 +481,7 @@ impl ast::DocCommentsOwner for ast::RecordField {} impl ast::DocCommentsOwner for ast::TupleField {} impl ast::DocCommentsOwner for ast::Enum {} impl ast::DocCommentsOwner for ast::Variant {} -impl ast::DocCommentsOwner for ast::TraitDef {} +impl ast::DocCommentsOwner for ast::Trait {} impl ast::DocCommentsOwner for ast::Module {} impl ast::DocCommentsOwner for ast::Static {} impl ast::DocCommentsOwner for ast::Const {} -- cgit v1.2.3