From 1766aae145c6925a33e427f2fe6ef2a56c301665 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:56:53 +0200 Subject: Rename EnumVariant -> Variant --- .../handlers/extract_struct_from_enum_variant.rs | 2 +- .../src/handlers/generate_from_impl_for_enum.rs | 4 +-- crates/ra_hir/src/has_source.rs | 4 +-- crates/ra_hir/src/semantics.rs | 2 +- crates/ra_hir/src/semantics/source_to_def.rs | 4 +-- crates/ra_hir_def/src/adt.rs | 4 +-- crates/ra_hir_def/src/child_by_source.rs | 2 +- crates/ra_hir_def/src/item_tree/lower.rs | 4 +-- crates/ra_hir_def/src/keys.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 4 +-- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/extend_selection.rs | 2 +- crates/ra_ide/src/file_structure.rs | 6 ++--- crates/ra_ide/src/folding_ranges.rs | 2 +- crates/ra_ide/src/references.rs | 2 +- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide_db/src/defs.rs | 2 +- crates/ra_parser/src/grammar.rs | 2 +- crates/ra_parser/src/grammar/items/adt.rs | 4 +-- crates/ra_parser/src/syntax_kind/generated.rs | 4 +-- crates/ra_syntax/src/ast/generated/nodes.rs | 30 +++++++++++----------- crates/ra_syntax/src/ast/node_ext.rs | 4 +-- crates/ra_syntax/src/parsing/text_tree_sink.rs | 2 +- .../ra_syntax/test_data/parser/err/0025_nope.rast | 20 +++++++-------- .../inline/ok/0118_impl_inner_attributes.rast | 2 +- .../inline/ok/0134_nocontentexpr_after_item.rast | 6 ++--- .../inline/ok/0157_variant_discriminant.rast | 4 +-- .../ra_syntax/test_data/parser/ok/0019_enums.rast | 26 +++++++++---------- .../parser/ok/0047_minus_in_inner_pattern.rast | 4 +-- crates/rust-analyzer/src/to_proto.rs | 2 +- xtask/src/ast_src.rs | 4 +-- xtask/src/codegen/rust.ungram | 8 +++--- 32 files changed, 86 insertions(+), 86 deletions(-) diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index 2b8e273b3..ccec688ca 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs @@ -31,7 +31,7 @@ pub(crate) fn extract_struct_from_enum_variant( acc: &mut Assists, ctx: &AssistContext, ) -> Option<()> { - let variant = ctx.find_node_at_offset::()?; + let variant = ctx.find_node_at_offset::()?; let field_list = match variant.kind() { ast::StructKind::Tuple(field_list) => field_list, _ => return None, diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs index a347e3c2e..5b282a30a 100644 --- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs @@ -22,7 +22,7 @@ use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists}; // } // ``` pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - let variant = ctx.find_node_at_offset::()?; + let variant = ctx.find_node_at_offset::()?; let variant_name = variant.name()?; let enum_name = variant.parent_enum().name()?; let field_list = match variant.kind() { @@ -69,7 +69,7 @@ impl From<{0}> for {1} {{ fn existing_from_impl( sema: &'_ hir::Semantics<'_, RootDatabase>, - variant: &ast::EnumVariant, + variant: &ast::Variant, ) -> Option<()> { let variant = sema.to_def(variant)?; let enum_ = variant.parent_enum(sema.db); diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 88399f724..1c5747581 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs @@ -75,8 +75,8 @@ impl HasSource for Enum { } } impl HasSource for EnumVariant { - type Ast = ast::EnumVariant; - fn source(self, db: &dyn HirDatabase) -> InFile { + type Ast = ast::Variant; + fn source(self, db: &dyn HirDatabase) -> InFile { self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) } } diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index f8e70fe27..e18df2537 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -591,7 +591,7 @@ to_def_impls![ (crate::Function, ast::Fn, fn_to_def), (crate::Field, ast::RecordField, record_field_to_def), (crate::Field, ast::TupleField, tuple_field_to_def), - (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), + (crate::EnumVariant, ast::Variant, enum_variant_to_def), (crate::TypeParam, ast::TypeParam, type_param_to_def), (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros (crate::Local, ast::BindPat, bind_pat_to_def), diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 9f81b952f..b85a12680 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -100,9 +100,9 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn enum_variant_to_def( &mut self, - src: InFile, + src: InFile, ) -> Option { - self.to_def(src, keys::ENUM_VARIANT) + self.to_def(src, keys::VARIANT) } pub(super) fn bind_pat_to_def( &mut self, diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index df98ded62..231c1dfab 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -112,7 +112,7 @@ impl EnumData { impl HasChildSource for EnumId { type ChildId = LocalEnumVariantId; - type Value = ast::EnumVariant; + type Value = ast::Variant; fn child_source(&self, db: &dyn DefDatabase) -> InFile> { let src = self.lookup(db).source(db); let mut trace = Trace::new_for_map(); @@ -123,7 +123,7 @@ impl HasChildSource for EnumId { fn lower_enum( db: &dyn DefDatabase, - trace: &mut Trace, + trace: &mut Trace, ast: &InFile, module_id: ModuleId, ) { diff --git a/crates/ra_hir_def/src/child_by_source.rs b/crates/ra_hir_def/src/child_by_source.rs index a885ec96d..dcb00a1d9 100644 --- a/crates/ra_hir_def/src/child_by_source.rs +++ b/crates/ra_hir_def/src/child_by_source.rs @@ -162,7 +162,7 @@ impl ChildBySource for EnumId { let arena_map = arena_map.as_ref(); for (local_id, source) in arena_map.value.iter() { let id = EnumVariantId { parent: *self, local_id }; - res[keys::ENUM_VARIANT].insert(arena_map.with_value(source.clone()), id) + res[keys::VARIANT].insert(arena_map.with_value(source.clone()), id) } res diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index da7238416..6d963c852 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -259,7 +259,7 @@ impl Ctx { Some(id(self.data().enums.alloc(res))) } - fn lower_variants(&mut self, variants: &ast::EnumVariantList) -> IdRange { + fn lower_variants(&mut self, variants: &ast::VariantList) -> IdRange { let start = self.next_variant_idx(); for variant in variants.variants() { if let Some(data) = self.lower_variant(&variant) { @@ -271,7 +271,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_variant(&mut self, variant: &ast::EnumVariant) -> Option { + fn lower_variant(&mut self, variant: &ast::Variant) -> Option { let name = variant.name()?.as_name(); let fields = self.lower_fields(&variant.kind()); let res = Variant { name, fields }; diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index 2695e8c24..c2a03dfed 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -24,7 +24,7 @@ pub const STRUCT: Key = Key::new(); pub const UNION: Key = Key::new(); pub const ENUM: Key = Key::new(); -pub const ENUM_VARIANT: Key = Key::new(); +pub const VARIANT: Key = Key::new(); pub const TUPLE_FIELD: Key = Key::new(); pub const RECORD_FIELD: Key = Key::new(); pub const TYPE_PARAM: Key = Key::new(); diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 02fefd6bb..c30b91fe0 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -388,7 +388,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::ConstDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(), ast::RecordField(it) => it.doc_comment_text(), - ast::EnumVariant(it) => it.doc_comment_text(), + ast::Variant(it) => it.doc_comment_text(), ast::MacroCall(it) => it.doc_comment_text(), _ => None, } @@ -413,7 +413,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::ConstDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(), ast::RecordField(it) => it.short_label(), - ast::EnumVariant(it) => it.short_label(), + ast::Variant(it) => it.short_label(), _ => None, } } diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 5bf70937f..ddf1059ee 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -71,7 +71,7 @@ impl ShortLabel for ast::RecordField { } } -impl ShortLabel for ast::EnumVariant { +impl ShortLabel for ast::Variant { fn short_label(&self) -> Option { Some(self.name()?.text().to_string()) } diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 04a7f0ac4..fc81b48cc 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -42,7 +42,7 @@ fn try_extend_selection( RECORD_FIELD_LIST, TUPLE_FIELD_LIST, RECORD_EXPR_FIELD_LIST, - ENUM_VARIANT_LIST, + VARIANT_LIST, USE_TREE_LIST, GENERIC_PARAM_LIST, TYPE_ARG_LIST, diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index c909f96aa..43202499d 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -129,7 +129,7 @@ fn structure_node(node: &SyntaxNode) -> Option { ast::Struct(it) => decl(it), ast::Union(it) => decl(it), ast::Enum(it) => decl(it), - ast::EnumVariant(it) => decl(it), + ast::Variant(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), ast::TypeAlias(it) => { @@ -319,7 +319,7 @@ fn very_obsolete() {} label: "X", navigation_range: 169..170, node_range: 169..170, - kind: ENUM_VARIANT, + kind: VARIANT, detail: None, deprecated: false, }, @@ -330,7 +330,7 @@ fn very_obsolete() {} label: "Y", navigation_range: 172..173, node_range: 172..178, - kind: ENUM_VARIANT, + kind: VARIANT, detail: None, deprecated: false, }, diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index 8dcce9f56..5a6e17936 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs @@ -93,7 +93,7 @@ fn fold_kind(kind: SyntaxKind) -> Option { | USE_TREE_LIST | BLOCK_EXPR | MATCH_ARM_LIST - | ENUM_VARIANT_LIST + | VARIANT_LIST | TOKEN_TREE => Some(FoldKind::Block), _ => None, } diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 2a62dab6c..519e4bf1a 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -390,7 +390,7 @@ enum Foo { } "#, ); - check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); + check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]); } #[test] diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 7e2833bd5..ce890c816 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -716,7 +716,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { FN => HighlightTag::Function, CONST_DEF => HighlightTag::Constant, STATIC_DEF => HighlightTag::Static, - ENUM_VARIANT => HighlightTag::EnumVariant, + VARIANT => HighlightTag::EnumVariant, BIND_PAT => HighlightTag::Local, _ => default, }; diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 586b3d750..635cf706c 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -170,7 +170,7 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option let def: hir::Static = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, - ast::EnumVariant(it) => { + ast::Variant(it) => { let def: hir::EnumVariant = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 03041d110..22a7acdf3 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -144,7 +144,7 @@ pub(crate) fn reparser( BLOCK_EXPR => expressions::block_expr, RECORD_FIELD_LIST => items::record_field_def_list, RECORD_EXPR_FIELD_LIST => items::record_field_list, - ENUM_VARIANT_LIST => items::enum_variant_list, + VARIANT_LIST => items::enum_variant_list, MATCH_ARM_LIST => items::match_arm_list, USE_TREE_LIST => items::use_tree_list, EXTERN_ITEM_LIST => items::extern_item_list, diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index aeb7ce86b..addfb59d4 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs @@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { if p.eat(T![=]) { expressions::expr(p); } - var.complete(p, ENUM_VARIANT); + var.complete(p, VARIANT); } else { var.abandon(p); p.err_and_bump("expected enum variant"); @@ -101,7 +101,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { } } p.expect(T!['}']); - m.complete(p, ENUM_VARIANT_LIST); + m.complete(p, VARIANT_LIST); } pub(crate) fn record_field_def_list(p: &mut Parser) { diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index fde9e55f1..3b82347f3 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -206,12 +206,12 @@ pub enum SyntaxKind { BIN_EXPR, EXTERN_BLOCK, EXTERN_ITEM_LIST, - ENUM_VARIANT, + VARIANT, RECORD_FIELD_LIST, RECORD_FIELD, TUPLE_FIELD_LIST, TUPLE_FIELD, - ENUM_VARIANT_LIST, + VARIANT_LIST, ITEM_LIST, ASSOC_ITEM_LIST, ATTR, diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 1d1452546..6613b54ba 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -53,7 +53,7 @@ impl ast::VisibilityOwner for Enum {} impl ast::GenericParamsOwner for Enum {} impl Enum { pub fn enum_token(&self) -> Option { support::token(&self.syntax, T![enum]) } - pub fn variant_list(&self) -> Option { support::child(&self.syntax) } + pub fn variant_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExternBlock { @@ -427,22 +427,22 @@ impl TupleField { pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumVariantList { +pub struct VariantList { pub(crate) syntax: SyntaxNode, } -impl EnumVariantList { +impl VariantList { pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn variants(&self) -> AstChildren { support::children(&self.syntax) } + pub fn variants(&self) -> AstChildren { support::children(&self.syntax) } pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumVariant { +pub struct Variant { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for EnumVariant {} -impl ast::NameOwner for EnumVariant {} -impl ast::VisibilityOwner for EnumVariant {} -impl EnumVariant { +impl ast::AttrsOwner for Variant {} +impl ast::NameOwner for Variant {} +impl ast::VisibilityOwner for Variant {} +impl Variant { pub fn field_list(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn expr(&self) -> Option { support::child(&self.syntax) } @@ -1806,8 +1806,8 @@ impl AstNode for TupleField { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for EnumVariantList { - fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } +impl AstNode for VariantList { + fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1817,8 +1817,8 @@ impl AstNode for EnumVariantList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for EnumVariant { - fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } +impl AstNode for Variant { + fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3640,12 +3640,12 @@ impl std::fmt::Display for TupleField { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for EnumVariantList { +impl std::fmt::Display for VariantList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for EnumVariant { +impl std::fmt::Display for Variant { 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 02e6e52c2..05ec49cec 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -247,7 +247,7 @@ impl ast::RecordFieldPat { } } -impl ast::EnumVariant { +impl ast::Variant { pub fn parent_enum(&self) -> ast::Enum { self.syntax() .parent() @@ -480,7 +480,7 @@ impl ast::DocCommentsOwner for ast::Union {} impl ast::DocCommentsOwner for ast::RecordField {} impl ast::DocCommentsOwner for ast::TupleField {} impl ast::DocCommentsOwner for ast::Enum {} -impl ast::DocCommentsOwner for ast::EnumVariant {} +impl ast::DocCommentsOwner for ast::Variant {} impl ast::DocCommentsOwner for ast::TraitDef {} impl ast::DocCommentsOwner for ast::Module {} impl ast::DocCommentsOwner for ast::StaticDef {} diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index faffd0d32..c586dc320 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>( trivias: impl Iterator, ) -> usize { match kind { - MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | ENUM_VARIANT | FN | TRAIT_DEF + MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => { let mut res = 0; let mut trivias = trivias.enumerate().peekable(); diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast index 94456e48c..fca646557 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast @@ -17,15 +17,15 @@ SOURCE_FILE@0..575 NAME@21..25 IDENT@21..25 "Test" WHITESPACE@25..26 " " - ENUM_VARIANT_LIST@26..152 + VARIANT_LIST@26..152 L_CURLY@26..27 "{" WHITESPACE@27..36 "\n " - ENUM_VARIANT@36..40 + VARIANT@36..40 NAME@36..40 IDENT@36..40 "Var1" COMMA@40..41 "," WHITESPACE@41..50 "\n " - ENUM_VARIANT@50..62 + VARIANT@50..62 NAME@50..54 IDENT@50..54 "Var2" TUPLE_FIELD_LIST@54..62 @@ -39,7 +39,7 @@ SOURCE_FILE@0..575 R_PAREN@61..62 ")" COMMA@62..63 "," WHITESPACE@63..72 "\n " - ENUM_VARIANT@72..145 + VARIANT@72..145 NAME@72..76 IDENT@72..76 "Var3" WHITESPACE@76..77 " " @@ -85,10 +85,10 @@ SOURCE_FILE@0..575 NAME@196..201 IDENT@196..201 "Test2" WHITESPACE@201..202 " " - ENUM_VARIANT_LIST@202..223 + VARIANT_LIST@202..223 L_CURLY@202..203 "{" WHITESPACE@203..212 "\n " - ENUM_VARIANT@212..216 + VARIANT@212..216 NAME@212..216 IDENT@212..216 "Fine" COMMA@216..217 "," @@ -101,10 +101,10 @@ SOURCE_FILE@0..575 NAME@234..239 IDENT@234..239 "Test3" WHITESPACE@239..240 " " - ENUM_VARIANT_LIST@240..300 + VARIANT_LIST@240..300 L_CURLY@240..241 "{" WHITESPACE@241..250 "\n " - ENUM_VARIANT@250..293 + VARIANT@250..293 NAME@250..259 IDENT@250..259 "StillFine" WHITESPACE@259..260 " " @@ -140,10 +140,10 @@ SOURCE_FILE@0..575 NAME@343..348 IDENT@343..348 "Test4" WHITESPACE@348..349 " " - ENUM_VARIANT_LIST@349..453 + VARIANT_LIST@349..453 L_CURLY@349..350 "{" WHITESPACE@350..363 "\n " - ENUM_VARIANT@363..372 + VARIANT@363..372 NAME@363..367 IDENT@363..367 "Nope" TUPLE_FIELD_LIST@367..372 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast index 25e6cc170..f2561abd6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..94 WHITESPACE@4..5 " " NAME@5..6 IDENT@5..6 "F" - ENUM_VARIANT_LIST@6..8 + VARIANT_LIST@6..8 L_CURLY@6..7 "{" R_CURLY@7..8 "}" WHITESPACE@8..9 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast index 9cc8172e0..429a0506e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast @@ -17,15 +17,15 @@ SOURCE_FILE@0..111 NAME@32..41 IDENT@32..41 "LocalEnum" WHITESPACE@41..42 " " - ENUM_VARIANT_LIST@42..75 + VARIANT_LIST@42..75 L_CURLY@42..43 "{" WHITESPACE@43..52 "\n " - ENUM_VARIANT@52..55 + VARIANT@52..55 NAME@52..55 IDENT@52..55 "One" COMMA@55..56 "," WHITESPACE@56..65 "\n " - ENUM_VARIANT@65..68 + VARIANT@65..68 NAME@65..68 IDENT@65..68 "Two" COMMA@68..69 "," diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast index 0331558d2..a2e05eb2e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast @@ -5,10 +5,10 @@ SOURCE_FILE@0..23 NAME@5..6 IDENT@5..6 "E" WHITESPACE@6..7 " " - ENUM_VARIANT_LIST@7..22 + VARIANT_LIST@7..22 L_CURLY@7..8 "{" WHITESPACE@8..9 " " - ENUM_VARIANT@9..20 + VARIANT@9..20 NAME@9..10 IDENT@9..10 "X" TUPLE_FIELD_LIST@10..15 diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast index 1ffcffc1a..c3df00814 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast @@ -5,7 +5,7 @@ SOURCE_FILE@0..182 NAME@5..7 IDENT@5..7 "E1" WHITESPACE@7..8 " " - ENUM_VARIANT_LIST@8..11 + VARIANT_LIST@8..11 L_CURLY@8..9 "{" WHITESPACE@9..10 "\n" R_CURLY@10..11 "}" @@ -22,7 +22,7 @@ SOURCE_FILE@0..182 IDENT@21..22 "T" R_ANGLE@22..23 ">" WHITESPACE@23..24 " " - ENUM_VARIANT_LIST@24..27 + VARIANT_LIST@24..27 L_CURLY@24..25 "{" WHITESPACE@25..26 "\n" R_CURLY@26..27 "}" @@ -33,10 +33,10 @@ SOURCE_FILE@0..182 NAME@34..36 IDENT@34..36 "E3" WHITESPACE@36..37 " " - ENUM_VARIANT_LIST@37..46 + VARIANT_LIST@37..46 L_CURLY@37..38 "{" WHITESPACE@38..43 "\n " - ENUM_VARIANT@43..44 + VARIANT@43..44 NAME@43..44 IDENT@43..44 "X" WHITESPACE@44..45 "\n" @@ -48,10 +48,10 @@ SOURCE_FILE@0..182 NAME@53..55 IDENT@53..55 "E4" WHITESPACE@55..56 " " - ENUM_VARIANT_LIST@56..66 + VARIANT_LIST@56..66 L_CURLY@56..57 "{" WHITESPACE@57..62 "\n " - ENUM_VARIANT@62..63 + VARIANT@62..63 NAME@62..63 IDENT@62..63 "X" COMMA@63..64 "," @@ -64,15 +64,15 @@ SOURCE_FILE@0..182 NAME@73..75 IDENT@73..75 "E5" WHITESPACE@75..76 " " - ENUM_VARIANT_LIST@76..181 + VARIANT_LIST@76..181 L_CURLY@76..77 "{" WHITESPACE@77..82 "\n " - ENUM_VARIANT@82..83 + VARIANT@82..83 NAME@82..83 IDENT@82..83 "A" COMMA@83..84 "," WHITESPACE@84..89 "\n " - ENUM_VARIANT@89..95 + VARIANT@89..95 NAME@89..90 IDENT@89..90 "B" WHITESPACE@90..91 " " @@ -82,7 +82,7 @@ SOURCE_FILE@0..182 INT_NUMBER@93..95 "92" COMMA@95..96 "," WHITESPACE@96..101 "\n " - ENUM_VARIANT@101..146 + VARIANT@101..146 NAME@101..102 IDENT@101..102 "C" WHITESPACE@102..103 " " @@ -119,7 +119,7 @@ SOURCE_FILE@0..182 R_CURLY@145..146 "}" COMMA@146..147 "," WHITESPACE@147..152 "\n " - ENUM_VARIANT@152..156 + VARIANT@152..156 NAME@152..153 IDENT@152..153 "F" WHITESPACE@153..154 " " @@ -128,7 +128,7 @@ SOURCE_FILE@0..182 R_CURLY@155..156 "}" COMMA@156..157 "," WHITESPACE@157..162 "\n " - ENUM_VARIANT@162..169 + VARIANT@162..169 NAME@162..163 IDENT@162..163 "D" TUPLE_FIELD_LIST@163..169 @@ -143,7 +143,7 @@ SOURCE_FILE@0..182 R_PAREN@168..169 ")" COMMA@169..170 "," WHITESPACE@170..175 "\n " - ENUM_VARIANT@175..178 + VARIANT@175..178 NAME@175..176 IDENT@175..176 "E" TUPLE_FIELD_LIST@176..178 diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast index 9db4f0aa1..7a54fa113 100644 --- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast @@ -262,10 +262,10 @@ SOURCE_FILE@0..395 NAME@348..349 IDENT@348..349 "A" WHITESPACE@349..350 " " - ENUM_VARIANT_LIST@350..367 + VARIANT_LIST@350..367 L_CURLY@350..351 "{" WHITESPACE@351..356 "\n " - ENUM_VARIANT@356..365 + VARIANT@356..365 NAME@356..357 IDENT@356..357 "B" TUPLE_FIELD_LIST@357..365 diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 62acbfb91..dcd81da6e 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -34,7 +34,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { SyntaxKind::FN => lsp_types::SymbolKind::Function, SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, SyntaxKind::ENUM => lsp_types::SymbolKind::Enum, - SyntaxKind::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, + SyntaxKind::VARIANT => lsp_types::SymbolKind::EnumMember, SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, SyntaxKind::MODULE => lsp_types::SymbolKind::Module, diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index fe8381e41..94f4d17aa 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -179,12 +179,12 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "BIN_EXPR", "EXTERN_BLOCK", "EXTERN_ITEM_LIST", - "ENUM_VARIANT", + "VARIANT", "RECORD_FIELD_LIST", "RECORD_FIELD", "TUPLE_FIELD_LIST", "TUPLE_FIELD", - "ENUM_VARIANT_LIST", + "VARIANT_LIST", "ITEM_LIST", "ASSOC_ITEM_LIST", "ATTR", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 9c6797cb7..48d4f4b4a 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -100,12 +100,12 @@ FieldList = Enum = Attr* Visibility? 'enum' Name GenericParamList? WhereClause? - variant_list:EnumVariantList + VariantList -EnumVariantList = - '{' variants:EnumVariant* '}' +VariantList = + '{' Variant* '}' -EnumVariant = +Variant = Attr* Visibility? Name FieldList ('=' Expr)? Union = -- cgit v1.2.3