diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 16:50:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 16:50:40 +0100 |
commit | 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 (patch) | |
tree | 2bda021d9fafc6af927ebfbcafd31537496bd53c /crates/ra_syntax/src/ast | |
parent | 1ae4721c9cfea746fce59a816b1c266bf373d6cf (diff) |
Rename StructDef -> Struct
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 42 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/node_ext.rs | 4 |
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)] |
158 | pub struct StructDef { | 158 | pub struct Struct { |
159 | pub(crate) syntax: SyntaxNode, | 159 | pub(crate) syntax: SyntaxNode, |
160 | } | 160 | } |
161 | impl ast::AttrsOwner for StructDef {} | 161 | impl ast::AttrsOwner for Struct {} |
162 | impl ast::NameOwner for StructDef {} | 162 | impl ast::NameOwner for Struct {} |
163 | impl ast::VisibilityOwner for StructDef {} | 163 | impl ast::VisibilityOwner for Struct {} |
164 | impl ast::GenericParamsOwner for StructDef {} | 164 | impl ast::GenericParamsOwner for Struct {} |
165 | impl StructDef { | 165 | impl 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 {} | |||
1391 | impl ast::VisibilityOwner for ExternItem {} | 1391 | impl ast::VisibilityOwner for ExternItem {} |
1392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1393 | pub enum AdtDef { | 1393 | pub 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 | } |
1523 | impl AstNode for StructDef { | 1523 | impl 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 { | |||
2801 | impl From<StaticDef> for Item { | 2801 | impl From<StaticDef> for Item { |
2802 | fn from(node: StaticDef) -> Item { Item::StaticDef(node) } | 2802 | fn from(node: StaticDef) -> Item { Item::StaticDef(node) } |
2803 | } | 2803 | } |
2804 | impl From<StructDef> for Item { | 2804 | impl From<Struct> for Item { |
2805 | fn from(node: StructDef) -> Item { Item::StructDef(node) } | 2805 | fn from(node: Struct) -> Item { Item::Struct(node) } |
2806 | } | 2806 | } |
2807 | impl From<TraitDef> for Item { | 2807 | impl 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 | } |
3375 | impl From<StructDef> for AdtDef { | 3375 | impl From<Struct> for AdtDef { |
3376 | fn from(node: StructDef) -> AdtDef { AdtDef::StructDef(node) } | 3376 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } |
3377 | } | 3377 | } |
3378 | impl From<EnumDef> for AdtDef { | 3378 | impl 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 { | |||
3384 | impl AstNode for AdtDef { | 3384 | impl 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 | } |
3513 | impl std::fmt::Display for StructDef { | 3513 | impl 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 | ||
186 | impl ast::StructDef { | 186 | impl 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 | ||
476 | impl ast::DocCommentsOwner for ast::SourceFile {} | 476 | impl ast::DocCommentsOwner for ast::SourceFile {} |
477 | impl ast::DocCommentsOwner for ast::Fn {} | 477 | impl ast::DocCommentsOwner for ast::Fn {} |
478 | impl ast::DocCommentsOwner for ast::StructDef {} | 478 | impl ast::DocCommentsOwner for ast::Struct {} |
479 | impl ast::DocCommentsOwner for ast::Union {} | 479 | impl ast::DocCommentsOwner for ast::Union {} |
480 | impl ast::DocCommentsOwner for ast::RecordField {} | 480 | impl ast::DocCommentsOwner for ast::RecordField {} |
481 | impl ast::DocCommentsOwner for ast::TupleField {} | 481 | impl ast::DocCommentsOwner for ast::TupleField {} |