diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-30 16:51:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-30 16:51:06 +0100 |
commit | 97df465391f50521c5102474d7e0ee2ea61ef48e (patch) | |
tree | 2bda021d9fafc6af927ebfbcafd31537496bd53c /crates/ra_syntax/src | |
parent | 0c8944314cb323416c8ad6ad27347ca056c5a91c (diff) | |
parent | 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 (diff) |
Merge #5602
5602: Rename StructDef -> Struct r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 42 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/node_ext.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/text_tree_sink.rs | 4 |
4 files changed, 26 insertions, 26 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 452e67c70..b69b6e85e 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -235,7 +235,7 @@ fn test_comments_preserve_trailing_whitespace() { | |||
235 | ) | 235 | ) |
236 | .ok() | 236 | .ok() |
237 | .unwrap(); | 237 | .unwrap(); |
238 | let def = file.syntax().descendants().find_map(StructDef::cast).unwrap(); | 238 | let def = file.syntax().descendants().find_map(Struct::cast).unwrap(); |
239 | assert_eq!( | 239 | assert_eq!( |
240 | "Representation of a Realm. \nIn the specification these are called Realm Records.", | 240 | "Representation of a Realm. \nIn the specification these are called Realm Records.", |
241 | def.doc_comment_text().unwrap() | 241 | def.doc_comment_text().unwrap() |
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 {} |
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index 0a1246c59..ef260ea59 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs | |||
@@ -146,8 +146,8 @@ fn n_attached_trivias<'a>( | |||
146 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, | 146 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, |
147 | ) -> usize { | 147 | ) -> usize { |
148 | match kind { | 148 | match kind { |
149 | MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN | 149 | MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM_DEF | ENUM_VARIANT | FN | TRAIT_DEF |
150 | | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => { | 150 | | MODULE | RECORD_FIELD | STATIC_DEF => { |
151 | let mut res = 0; | 151 | let mut res = 0; |
152 | let mut trivias = trivias.enumerate().peekable(); | 152 | let mut trivias = trivias.enumerate().peekable(); |
153 | 153 | ||