aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 16:52:53 +0100
committerAleksey Kladov <[email protected]>2020-07-30 16:52:53 +0100
commit609680ef97dbf82c07b6b06e21aa366423892304 (patch)
tree34296539101d8db4a484c472a45a1e30503791ef /crates/ra_syntax/src
parent216a5344c8ef3c3e430d2761dc8b1a7b60250a15 (diff)
Rename EnumDef -> Enum
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs42
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs6
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs2
3 files changed, 25 insertions, 25 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 0fd3d4f1b..1d1452546 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -44,14 +44,14 @@ impl ConstDef {
44 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 44 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
45} 45}
46#[derive(Debug, Clone, PartialEq, Eq, Hash)] 46#[derive(Debug, Clone, PartialEq, Eq, Hash)]
47pub struct EnumDef { 47pub struct Enum {
48 pub(crate) syntax: SyntaxNode, 48 pub(crate) syntax: SyntaxNode,
49} 49}
50impl ast::AttrsOwner for EnumDef {} 50impl ast::AttrsOwner for Enum {}
51impl ast::NameOwner for EnumDef {} 51impl ast::NameOwner for Enum {}
52impl ast::VisibilityOwner for EnumDef {} 52impl ast::VisibilityOwner for Enum {}
53impl ast::GenericParamsOwner for EnumDef {} 53impl ast::GenericParamsOwner for Enum {}
54impl EnumDef { 54impl Enum {
55 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } 55 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
56 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } 56 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
57} 57}
@@ -1273,7 +1273,7 @@ impl MetaItem {
1273#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1273#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1274pub enum Item { 1274pub enum Item {
1275 ConstDef(ConstDef), 1275 ConstDef(ConstDef),
1276 EnumDef(EnumDef), 1276 Enum(Enum),
1277 ExternBlock(ExternBlock), 1277 ExternBlock(ExternBlock),
1278 ExternCrate(ExternCrate), 1278 ExternCrate(ExternCrate),
1279 Fn(Fn), 1279 Fn(Fn),
@@ -1392,7 +1392,7 @@ impl 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 Struct(Struct), 1394 Struct(Struct),
1395 EnumDef(EnumDef), 1395 Enum(Enum),
1396 Union(Union), 1396 Union(Union),
1397} 1397}
1398impl ast::AttrsOwner for AdtDef {} 1398impl ast::AttrsOwner for AdtDef {}
@@ -1432,8 +1432,8 @@ impl AstNode for ConstDef {
1432 } 1432 }
1433 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1433 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1434} 1434}
1435impl AstNode for EnumDef { 1435impl AstNode for Enum {
1436 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } 1436 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM }
1437 fn cast(syntax: SyntaxNode) -> Option<Self> { 1437 fn cast(syntax: SyntaxNode) -> Option<Self> {
1438 if Self::can_cast(syntax.kind()) { 1438 if Self::can_cast(syntax.kind()) {
1439 Some(Self { syntax }) 1439 Some(Self { syntax })
@@ -2777,8 +2777,8 @@ impl AstNode for MetaItem {
2777impl From<ConstDef> for Item { 2777impl From<ConstDef> for Item {
2778 fn from(node: ConstDef) -> Item { Item::ConstDef(node) } 2778 fn from(node: ConstDef) -> Item { Item::ConstDef(node) }
2779} 2779}
2780impl From<EnumDef> for Item { 2780impl From<Enum> for Item {
2781 fn from(node: EnumDef) -> Item { Item::EnumDef(node) } 2781 fn from(node: Enum) -> Item { Item::Enum(node) }
2782} 2782}
2783impl From<ExternBlock> for Item { 2783impl From<ExternBlock> for Item {
2784 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } 2784 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) }
@@ -2819,7 +2819,7 @@ impl From<Use> for Item {
2819impl AstNode for Item { 2819impl 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 | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
2823 | MODULE | STATIC_DEF | STRUCT | 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 }
@@ -2827,7 +2827,7 @@ impl AstNode for Item {
2827 fn cast(syntax: SyntaxNode) -> Option<Self> { 2827 fn cast(syntax: SyntaxNode) -> Option<Self> {
2828 let res = match syntax.kind() { 2828 let res = match syntax.kind() {
2829 CONST_DEF => Item::ConstDef(ConstDef { syntax }), 2829 CONST_DEF => Item::ConstDef(ConstDef { syntax }),
2830 ENUM_DEF => Item::EnumDef(EnumDef { syntax }), 2830 ENUM => Item::Enum(Enum { syntax }),
2831 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), 2831 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
2832 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), 2832 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
2833 FN => Item::Fn(Fn { syntax }), 2833 FN => Item::Fn(Fn { syntax }),
@@ -2847,7 +2847,7 @@ impl AstNode for Item {
2847 fn syntax(&self) -> &SyntaxNode { 2847 fn syntax(&self) -> &SyntaxNode {
2848 match self { 2848 match self {
2849 Item::ConstDef(it) => &it.syntax, 2849 Item::ConstDef(it) => &it.syntax,
2850 Item::EnumDef(it) => &it.syntax, 2850 Item::Enum(it) => &it.syntax,
2851 Item::ExternBlock(it) => &it.syntax, 2851 Item::ExternBlock(it) => &it.syntax,
2852 Item::ExternCrate(it) => &it.syntax, 2852 Item::ExternCrate(it) => &it.syntax,
2853 Item::Fn(it) => &it.syntax, 2853 Item::Fn(it) => &it.syntax,
@@ -3375,8 +3375,8 @@ impl AstNode for ExternItem {
3375impl From<Struct> for AdtDef { 3375impl From<Struct> for AdtDef {
3376 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } 3376 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
3377} 3377}
3378impl From<EnumDef> for AdtDef { 3378impl From<Enum> for AdtDef {
3379 fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } 3379 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) }
3380} 3380}
3381impl From<Union> for AdtDef { 3381impl From<Union> for AdtDef {
3382 fn from(node: Union) -> AdtDef { AdtDef::Union(node) } 3382 fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
@@ -3384,14 +3384,14 @@ 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 | ENUM_DEF | UNION => true, 3387 STRUCT | ENUM | 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 => AdtDef::Struct(Struct { syntax }), 3393 STRUCT => AdtDef::Struct(Struct { syntax }),
3394 ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), 3394 ENUM => AdtDef::Enum(Enum { syntax }),
3395 UNION => AdtDef::Union(Union { syntax }), 3395 UNION => AdtDef::Union(Union { syntax }),
3396 _ => return None, 3396 _ => return None,
3397 }; 3397 };
@@ -3400,7 +3400,7 @@ impl AstNode for AdtDef {
3400 fn syntax(&self) -> &SyntaxNode { 3400 fn syntax(&self) -> &SyntaxNode {
3401 match self { 3401 match self {
3402 AdtDef::Struct(it) => &it.syntax, 3402 AdtDef::Struct(it) => &it.syntax,
3403 AdtDef::EnumDef(it) => &it.syntax, 3403 AdtDef::Enum(it) => &it.syntax,
3404 AdtDef::Union(it) => &it.syntax, 3404 AdtDef::Union(it) => &it.syntax,
3405 } 3405 }
3406 } 3406 }
@@ -3470,7 +3470,7 @@ impl std::fmt::Display for ConstDef {
3470 std::fmt::Display::fmt(self.syntax(), f) 3470 std::fmt::Display::fmt(self.syntax(), f)
3471 } 3471 }
3472} 3472}
3473impl std::fmt::Display for EnumDef { 3473impl std::fmt::Display for Enum {
3474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3475 std::fmt::Display::fmt(self.syntax(), f) 3475 std::fmt::Display::fmt(self.syntax(), f)
3476 } 3476 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 2299988ce..02e6e52c2 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -248,11 +248,11 @@ impl ast::RecordFieldPat {
248} 248}
249 249
250impl ast::EnumVariant { 250impl ast::EnumVariant {
251 pub fn parent_enum(&self) -> ast::EnumDef { 251 pub fn parent_enum(&self) -> ast::Enum {
252 self.syntax() 252 self.syntax()
253 .parent() 253 .parent()
254 .and_then(|it| it.parent()) 254 .and_then(|it| it.parent())
255 .and_then(ast::EnumDef::cast) 255 .and_then(ast::Enum::cast)
256 .expect("EnumVariants are always nested in Enums") 256 .expect("EnumVariants are always nested in Enums")
257 } 257 }
258 pub fn kind(&self) -> StructKind { 258 pub fn kind(&self) -> StructKind {
@@ -479,7 +479,7 @@ impl 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 {}
482impl ast::DocCommentsOwner for ast::EnumDef {} 482impl ast::DocCommentsOwner for ast::Enum {}
483impl ast::DocCommentsOwner for ast::EnumVariant {} 483impl ast::DocCommentsOwner for ast::EnumVariant {}
484impl ast::DocCommentsOwner for ast::TraitDef {} 484impl ast::DocCommentsOwner for ast::TraitDef {}
485impl ast::DocCommentsOwner for ast::Module {} 485impl ast::DocCommentsOwner for ast::Module {}
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index ef260ea59..faffd0d32 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -146,7 +146,7 @@ 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 | ENUM_DEF | ENUM_VARIANT | FN | TRAIT_DEF 149 MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | ENUM_VARIANT | FN | TRAIT_DEF
150 | 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();