aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs42
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs4
2 files changed, 23 insertions, 23 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index d153e8528..0fd3d4f1b 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -155,14 +155,14 @@ impl StaticDef {
155 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 155 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
156} 156}
157#[derive(Debug, Clone, PartialEq, Eq, Hash)] 157#[derive(Debug, Clone, PartialEq, Eq, Hash)]
158pub struct StructDef { 158pub struct Struct {
159 pub(crate) syntax: SyntaxNode, 159 pub(crate) syntax: SyntaxNode,
160} 160}
161impl ast::AttrsOwner for StructDef {} 161impl ast::AttrsOwner for Struct {}
162impl ast::NameOwner for StructDef {} 162impl ast::NameOwner for Struct {}
163impl ast::VisibilityOwner for StructDef {} 163impl ast::VisibilityOwner for Struct {}
164impl ast::GenericParamsOwner for StructDef {} 164impl ast::GenericParamsOwner for Struct {}
165impl StructDef { 165impl Struct {
166 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } 166 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
167 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 167 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
168 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } 168 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
@@ -1281,7 +1281,7 @@ pub enum Item {
1281 MacroCall(MacroCall), 1281 MacroCall(MacroCall),
1282 Module(Module), 1282 Module(Module),
1283 StaticDef(StaticDef), 1283 StaticDef(StaticDef),
1284 StructDef(StructDef), 1284 Struct(Struct),
1285 TraitDef(TraitDef), 1285 TraitDef(TraitDef),
1286 TypeAlias(TypeAlias), 1286 TypeAlias(TypeAlias),
1287 Union(Union), 1287 Union(Union),
@@ -1391,7 +1391,7 @@ impl ast::NameOwner for ExternItem {}
1391impl ast::VisibilityOwner for ExternItem {} 1391impl ast::VisibilityOwner for ExternItem {}
1392#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1392#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1393pub enum AdtDef { 1393pub enum AdtDef {
1394 StructDef(StructDef), 1394 Struct(Struct),
1395 EnumDef(EnumDef), 1395 EnumDef(EnumDef),
1396 Union(Union), 1396 Union(Union),
1397} 1397}
@@ -1520,8 +1520,8 @@ impl AstNode for StaticDef {
1520 } 1520 }
1521 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1521 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1522} 1522}
1523impl AstNode for StructDef { 1523impl AstNode for Struct {
1524 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } 1524 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT }
1525 fn cast(syntax: SyntaxNode) -> Option<Self> { 1525 fn cast(syntax: SyntaxNode) -> Option<Self> {
1526 if Self::can_cast(syntax.kind()) { 1526 if Self::can_cast(syntax.kind()) {
1527 Some(Self { syntax }) 1527 Some(Self { syntax })
@@ -2801,8 +2801,8 @@ impl From<Module> for Item {
2801impl From<StaticDef> for Item { 2801impl From<StaticDef> for Item {
2802 fn from(node: StaticDef) -> Item { Item::StaticDef(node) } 2802 fn from(node: StaticDef) -> Item { Item::StaticDef(node) }
2803} 2803}
2804impl From<StructDef> for Item { 2804impl From<Struct> for Item {
2805 fn from(node: StructDef) -> Item { Item::StructDef(node) } 2805 fn from(node: Struct) -> Item { Item::Struct(node) }
2806} 2806}
2807impl From<TraitDef> for Item { 2807impl From<TraitDef> for Item {
2808 fn from(node: TraitDef) -> Item { Item::TraitDef(node) } 2808 fn from(node: TraitDef) -> Item { Item::TraitDef(node) }
@@ -2820,7 +2820,7 @@ impl AstNode for Item {
2820 fn can_cast(kind: SyntaxKind) -> bool { 2820 fn can_cast(kind: SyntaxKind) -> bool {
2821 match kind { 2821 match kind {
2822 CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL 2822 CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
2823 | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, 2823 | MODULE | STATIC_DEF | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true,
2824 _ => false, 2824 _ => false,
2825 } 2825 }
2826 } 2826 }
@@ -2835,7 +2835,7 @@ impl AstNode for Item {
2835 MACRO_CALL => Item::MacroCall(MacroCall { syntax }), 2835 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
2836 MODULE => Item::Module(Module { syntax }), 2836 MODULE => Item::Module(Module { syntax }),
2837 STATIC_DEF => Item::StaticDef(StaticDef { syntax }), 2837 STATIC_DEF => Item::StaticDef(StaticDef { syntax }),
2838 STRUCT_DEF => Item::StructDef(StructDef { syntax }), 2838 STRUCT => Item::Struct(Struct { syntax }),
2839 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), 2839 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
2840 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), 2840 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
2841 UNION => Item::Union(Union { syntax }), 2841 UNION => Item::Union(Union { syntax }),
@@ -2855,7 +2855,7 @@ impl AstNode for Item {
2855 Item::MacroCall(it) => &it.syntax, 2855 Item::MacroCall(it) => &it.syntax,
2856 Item::Module(it) => &it.syntax, 2856 Item::Module(it) => &it.syntax,
2857 Item::StaticDef(it) => &it.syntax, 2857 Item::StaticDef(it) => &it.syntax,
2858 Item::StructDef(it) => &it.syntax, 2858 Item::Struct(it) => &it.syntax,
2859 Item::TraitDef(it) => &it.syntax, 2859 Item::TraitDef(it) => &it.syntax,
2860 Item::TypeAlias(it) => &it.syntax, 2860 Item::TypeAlias(it) => &it.syntax,
2861 Item::Union(it) => &it.syntax, 2861 Item::Union(it) => &it.syntax,
@@ -3372,8 +3372,8 @@ impl AstNode for ExternItem {
3372 } 3372 }
3373 } 3373 }
3374} 3374}
3375impl From<StructDef> for AdtDef { 3375impl From<Struct> for AdtDef {
3376 fn from(node: StructDef) -> AdtDef { AdtDef::StructDef(node) } 3376 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
3377} 3377}
3378impl From<EnumDef> for AdtDef { 3378impl From<EnumDef> for AdtDef {
3379 fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } 3379 fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) }
@@ -3384,13 +3384,13 @@ impl From<Union> for AdtDef {
3384impl AstNode for AdtDef { 3384impl AstNode for AdtDef {
3385 fn can_cast(kind: SyntaxKind) -> bool { 3385 fn can_cast(kind: SyntaxKind) -> bool {
3386 match kind { 3386 match kind {
3387 STRUCT_DEF | ENUM_DEF | UNION => true, 3387 STRUCT | ENUM_DEF | UNION => true,
3388 _ => false, 3388 _ => false,
3389 } 3389 }
3390 } 3390 }
3391 fn cast(syntax: SyntaxNode) -> Option<Self> { 3391 fn cast(syntax: SyntaxNode) -> Option<Self> {
3392 let res = match syntax.kind() { 3392 let res = match syntax.kind() {
3393 STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), 3393 STRUCT => AdtDef::Struct(Struct { syntax }),
3394 ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), 3394 ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }),
3395 UNION => AdtDef::Union(Union { syntax }), 3395 UNION => AdtDef::Union(Union { syntax }),
3396 _ => return None, 3396 _ => return None,
@@ -3399,7 +3399,7 @@ impl AstNode for AdtDef {
3399 } 3399 }
3400 fn syntax(&self) -> &SyntaxNode { 3400 fn syntax(&self) -> &SyntaxNode {
3401 match self { 3401 match self {
3402 AdtDef::StructDef(it) => &it.syntax, 3402 AdtDef::Struct(it) => &it.syntax,
3403 AdtDef::EnumDef(it) => &it.syntax, 3403 AdtDef::EnumDef(it) => &it.syntax,
3404 AdtDef::Union(it) => &it.syntax, 3404 AdtDef::Union(it) => &it.syntax,
3405 } 3405 }
@@ -3510,7 +3510,7 @@ impl std::fmt::Display for StaticDef {
3510 std::fmt::Display::fmt(self.syntax(), f) 3510 std::fmt::Display::fmt(self.syntax(), f)
3511 } 3511 }
3512} 3512}
3513impl std::fmt::Display for StructDef { 3513impl std::fmt::Display for Struct {
3514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3515 std::fmt::Display::fmt(self.syntax(), f) 3515 std::fmt::Display::fmt(self.syntax(), f)
3516 } 3516 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index ce11a7513..2299988ce 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -183,7 +183,7 @@ impl StructKind {
183 } 183 }
184} 184}
185 185
186impl ast::StructDef { 186impl ast::Struct {
187 pub fn kind(&self) -> StructKind { 187 pub fn kind(&self) -> StructKind {
188 StructKind::from_node(self) 188 StructKind::from_node(self)
189 } 189 }
@@ -475,7 +475,7 @@ impl ast::TokenTree {
475 475
476impl ast::DocCommentsOwner for ast::SourceFile {} 476impl ast::DocCommentsOwner for ast::SourceFile {}
477impl ast::DocCommentsOwner for ast::Fn {} 477impl ast::DocCommentsOwner for ast::Fn {}
478impl ast::DocCommentsOwner for ast::StructDef {} 478impl ast::DocCommentsOwner for ast::Struct {}
479impl ast::DocCommentsOwner for ast::Union {} 479impl ast::DocCommentsOwner for ast::Union {}
480impl ast::DocCommentsOwner for ast::RecordField {} 480impl ast::DocCommentsOwner for ast::RecordField {}
481impl ast::DocCommentsOwner for ast::TupleField {} 481impl ast::DocCommentsOwner for ast::TupleField {}