diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 16:52:53 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 16:52:53 +0100 |
commit | 609680ef97dbf82c07b6b06e21aa366423892304 (patch) | |
tree | 34296539101d8db4a484c472a45a1e30503791ef | |
parent | 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 (diff) |
Rename EnumDef -> Enum
35 files changed, 83 insertions, 83 deletions
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 12c40a3cc..44f3e8ee3 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, NameOwner, VisibilityOwner}, | 2 | ast::{self, NameOwner, VisibilityOwner}, |
3 | AstNode, | 3 | AstNode, |
4 | SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT, TRAIT_DEF, VISIBILITY}, | 4 | SyntaxKind::{CONST_DEF, ENUM, FN, MODULE, STATIC_DEF, STRUCT, TRAIT_DEF, VISIBILITY}, |
5 | T, | 5 | T, |
6 | }; | 6 | }; |
7 | use test_utils::mark; | 7 | use test_utils::mark; |
@@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
36 | 36 | ||
37 | let (offset, target) = if let Some(keyword) = item_keyword { | 37 | let (offset, target) = if let Some(keyword) = item_keyword { |
38 | let parent = keyword.parent(); | 38 | let parent = keyword.parent(); |
39 | let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT, ENUM_DEF, TRAIT_DEF]; | 39 | let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT, ENUM, TRAIT_DEF]; |
40 | // Parent is not a definition, can't add visibility | 40 | // Parent is not a definition, can't add visibility |
41 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { | 41 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { |
42 | return None; | 42 | return None; |
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 3b82477c5..84ac75fa8 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs | |||
@@ -40,7 +40,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext | |||
40 | ast::Fn(it) => it.body()?.syntax().clone().into(), | 40 | ast::Fn(it) => it.body()?.syntax().clone().into(), |
41 | ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 41 | ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), |
42 | ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 42 | ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), |
43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), | 43 | ast::Enum(it) => it.variant_list()?.syntax().clone().into(), |
44 | ast::Struct(it) => { | 44 | ast::Struct(it) => { |
45 | it.syntax().children_with_tokens() | 45 | it.syntax().children_with_tokens() |
46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? | 46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? |
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 811a12e00..88399f724 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs | |||
@@ -69,8 +69,8 @@ impl HasSource for Union { | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | impl HasSource for Enum { | 71 | impl HasSource for Enum { |
72 | type Ast = ast::EnumDef; | 72 | type Ast = ast::Enum; |
73 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::EnumDef> { | 73 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Enum> { |
74 | self.id.lookup(db.upcast()).source(db.upcast()) | 74 | self.id.lookup(db.upcast()).source(db.upcast()) |
75 | } | 75 | } |
76 | } | 76 | } |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 7df018b05..f8e70fe27 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -581,7 +581,7 @@ macro_rules! to_def_impls { | |||
581 | to_def_impls![ | 581 | to_def_impls![ |
582 | (crate::Module, ast::Module, module_to_def), | 582 | (crate::Module, ast::Module, module_to_def), |
583 | (crate::Struct, ast::Struct, struct_to_def), | 583 | (crate::Struct, ast::Struct, struct_to_def), |
584 | (crate::Enum, ast::EnumDef, enum_to_def), | 584 | (crate::Enum, ast::Enum, enum_to_def), |
585 | (crate::Union, ast::Union, union_to_def), | 585 | (crate::Union, ast::Union, union_to_def), |
586 | (crate::Trait, ast::TraitDef, trait_to_def), | 586 | (crate::Trait, ast::TraitDef, trait_to_def), |
587 | (crate::ImplDef, ast::ImplDef, impl_to_def), | 587 | (crate::ImplDef, ast::ImplDef, impl_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 75b773352..9f81b952f 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -77,7 +77,7 @@ impl SourceToDefCtx<'_, '_> { | |||
77 | pub(super) fn struct_to_def(&mut self, src: InFile<ast::Struct>) -> Option<StructId> { | 77 | pub(super) fn struct_to_def(&mut self, src: InFile<ast::Struct>) -> Option<StructId> { |
78 | self.to_def(src, keys::STRUCT) | 78 | self.to_def(src, keys::STRUCT) |
79 | } | 79 | } |
80 | pub(super) fn enum_to_def(&mut self, src: InFile<ast::EnumDef>) -> Option<EnumId> { | 80 | pub(super) fn enum_to_def(&mut self, src: InFile<ast::Enum>) -> Option<EnumId> { |
81 | self.to_def(src, keys::ENUM) | 81 | self.to_def(src, keys::ENUM) |
82 | } | 82 | } |
83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { | 83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { |
@@ -170,7 +170,7 @@ impl SourceToDefCtx<'_, '_> { | |||
170 | let def = self.struct_to_def(container.with_value(it))?; | 170 | let def = self.struct_to_def(container.with_value(it))?; |
171 | VariantId::from(def).into() | 171 | VariantId::from(def).into() |
172 | }, | 172 | }, |
173 | ast::EnumDef(it) => { | 173 | ast::Enum(it) => { |
174 | let def = self.enum_to_def(container.with_value(it))?; | 174 | let def = self.enum_to_def(container.with_value(it))?; |
175 | def.into() | 175 | def.into() |
176 | }, | 176 | }, |
@@ -206,7 +206,7 @@ impl SourceToDefCtx<'_, '_> { | |||
206 | match (container.value) { | 206 | match (container.value) { |
207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), | 207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), | 208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), |
209 | ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), | 209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), |
210 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), | 210 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), |
211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), | 211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), |
212 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), | 212 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), |
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 2be23c45d..df98ded62 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -124,7 +124,7 @@ impl HasChildSource for EnumId { | |||
124 | fn lower_enum( | 124 | fn lower_enum( |
125 | db: &dyn DefDatabase, | 125 | db: &dyn DefDatabase, |
126 | trace: &mut Trace<EnumVariantData, ast::EnumVariant>, | 126 | trace: &mut Trace<EnumVariantData, ast::EnumVariant>, |
127 | ast: &InFile<ast::EnumDef>, | 127 | ast: &InFile<ast::Enum>, |
128 | module_id: ModuleId, | 128 | module_id: ModuleId, |
129 | ) { | 129 | ) { |
130 | let expander = CfgExpander::new(db, ast.file_id, module_id.krate); | 130 | let expander = CfgExpander::new(db, ast.file_id, module_id.krate); |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 840841d87..105299f70 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -656,7 +656,7 @@ impl ExprCollector<'_> { | |||
656 | let id = self.find_inner_item(&def)?; | 656 | let id = self.find_inner_item(&def)?; |
657 | (StructLoc { container, id }.intern(self.db).into(), def.name()) | 657 | (StructLoc { container, id }.intern(self.db).into(), def.name()) |
658 | } | 658 | } |
659 | ast::Item::EnumDef(def) => { | 659 | ast::Item::Enum(def) => { |
660 | let id = self.find_inner_item(&def)?; | 660 | let id = self.find_inner_item(&def)?; |
661 | (EnumLoc { container, id }.intern(self.db).into(), def.name()) | 661 | (EnumLoc { container, id }.intern(self.db).into(), def.name()) |
662 | } | 662 | } |
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index 6b96a4c20..24ad41187 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -416,7 +416,7 @@ mod_items! { | |||
416 | Function in functions -> ast::Fn, | 416 | Function in functions -> ast::Fn, |
417 | Struct in structs -> ast::Struct, | 417 | Struct in structs -> ast::Struct, |
418 | Union in unions -> ast::Union, | 418 | Union in unions -> ast::Union, |
419 | Enum in enums -> ast::EnumDef, | 419 | Enum in enums -> ast::Enum, |
420 | Const in consts -> ast::ConstDef, | 420 | Const in consts -> ast::ConstDef, |
421 | Static in statics -> ast::StaticDef, | 421 | Static in statics -> ast::StaticDef, |
422 | Trait in traits -> ast::TraitDef, | 422 | Trait in traits -> ast::TraitDef, |
@@ -543,7 +543,7 @@ pub struct Enum { | |||
543 | pub visibility: RawVisibilityId, | 543 | pub visibility: RawVisibilityId, |
544 | pub generic_params: GenericParamsId, | 544 | pub generic_params: GenericParamsId, |
545 | pub variants: IdRange<Variant>, | 545 | pub variants: IdRange<Variant>, |
546 | pub ast_id: FileAstId<ast::EnumDef>, | 546 | pub ast_id: FileAstId<ast::Enum>, |
547 | } | 547 | } |
548 | 548 | ||
549 | #[derive(Debug, Clone, Eq, PartialEq)] | 549 | #[derive(Debug, Clone, Eq, PartialEq)] |
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index a85618015..da7238416 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -80,7 +80,7 @@ impl Ctx { | |||
80 | match item { | 80 | match item { |
81 | ast::Item::Struct(_) | 81 | ast::Item::Struct(_) |
82 | | ast::Item::Union(_) | 82 | | ast::Item::Union(_) |
83 | | ast::Item::EnumDef(_) | 83 | | ast::Item::Enum(_) |
84 | | ast::Item::Fn(_) | 84 | | ast::Item::Fn(_) |
85 | | ast::Item::TypeAlias(_) | 85 | | ast::Item::TypeAlias(_) |
86 | | ast::Item::ConstDef(_) | 86 | | ast::Item::ConstDef(_) |
@@ -105,7 +105,7 @@ impl Ctx { | |||
105 | let items = match item { | 105 | let items = match item { |
106 | ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into), | 106 | ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into), |
107 | ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), | 107 | ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), |
108 | ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), | 108 | ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), |
109 | ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), | 109 | ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), |
110 | ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), | 110 | ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), |
111 | ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), | 111 | ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), |
@@ -246,7 +246,7 @@ impl Ctx { | |||
246 | Some(id(self.data().unions.alloc(res))) | 246 | Some(id(self.data().unions.alloc(res))) |
247 | } | 247 | } |
248 | 248 | ||
249 | fn lower_enum(&mut self, enum_: &ast::EnumDef) -> Option<FileItemTreeId<Enum>> { | 249 | fn lower_enum(&mut self, enum_: &ast::Enum) -> Option<FileItemTreeId<Enum>> { |
250 | let visibility = self.lower_visibility(enum_); | 250 | let visibility = self.lower_visibility(enum_); |
251 | let name = enum_.name()?.as_name(); | 251 | let name = enum_.name()?.as_name(); |
252 | let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); | 252 | let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); |
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs index db37223da..bf3474c51 100644 --- a/crates/ra_hir_def/src/item_tree/tests.rs +++ b/crates/ra_hir_def/src/item_tree/tests.rs | |||
@@ -250,7 +250,7 @@ fn smoke() { | |||
250 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }] | 250 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }] |
251 | Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(5), kind: Record } | 251 | Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(5), kind: Record } |
252 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }] | 252 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }] |
253 | Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::EnumDef>(6) } | 253 | Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Enum>(6) } |
254 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] | 254 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] |
255 | Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Union>(7) } | 255 | Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Union>(7) } |
256 | "##]], | 256 | "##]], |
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index d9ec0f305..2695e8c24 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs | |||
@@ -22,7 +22,7 @@ pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); | |||
22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); | 22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); |
23 | pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); | 23 | pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); |
24 | pub const UNION: Key<ast::Union, UnionId> = Key::new(); | 24 | pub const UNION: Key<ast::Union, UnionId> = Key::new(); |
25 | pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); | 25 | pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); |
26 | 26 | ||
27 | pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); | 27 | pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); |
28 | pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new(); | 28 | pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new(); |
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index 489ec0513..69fa907cb 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs | |||
@@ -73,7 +73,7 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> { | |||
73 | let (name, params) = match_ast! { | 73 | let (name, params) = match_ast! { |
74 | match node { | 74 | match node { |
75 | ast::Struct(it) => (it.name(), it.generic_param_list()), | 75 | ast::Struct(it) => (it.name(), it.generic_param_list()), |
76 | ast::EnumDef(it) => (it.name(), it.generic_param_list()), | 76 | ast::Enum(it) => (it.name(), it.generic_param_list()), |
77 | ast::Union(it) => (it.name(), it.generic_param_list()), | 77 | ast::Union(it) => (it.name(), it.generic_param_list()), |
78 | _ => { | 78 | _ => { |
79 | debug!("unexpected node is {:?}", node); | 79 | debug!("unexpected node is {:?}", node); |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 5686faaab..02fefd6bb 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -381,7 +381,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option | |||
381 | match node { | 381 | match node { |
382 | ast::Fn(it) => it.doc_comment_text(), | 382 | ast::Fn(it) => it.doc_comment_text(), |
383 | ast::Struct(it) => it.doc_comment_text(), | 383 | ast::Struct(it) => it.doc_comment_text(), |
384 | ast::EnumDef(it) => it.doc_comment_text(), | 384 | ast::Enum(it) => it.doc_comment_text(), |
385 | ast::TraitDef(it) => it.doc_comment_text(), | 385 | ast::TraitDef(it) => it.doc_comment_text(), |
386 | ast::Module(it) => it.doc_comment_text(), | 386 | ast::Module(it) => it.doc_comment_text(), |
387 | ast::TypeAlias(it) => it.doc_comment_text(), | 387 | ast::TypeAlias(it) => it.doc_comment_text(), |
@@ -406,7 +406,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
406 | match node { | 406 | match node { |
407 | ast::Fn(it) => it.short_label(), | 407 | ast::Fn(it) => it.short_label(), |
408 | ast::Struct(it) => it.short_label(), | 408 | ast::Struct(it) => it.short_label(), |
409 | ast::EnumDef(it) => it.short_label(), | 409 | ast::Enum(it) => it.short_label(), |
410 | ast::TraitDef(it) => it.short_label(), | 410 | ast::TraitDef(it) => it.short_label(), |
411 | ast::Module(it) => it.short_label(), | 411 | ast::Module(it) => it.short_label(), |
412 | ast::TypeAlias(it) => it.short_label(), | 412 | ast::TypeAlias(it) => it.short_label(), |
@@ -446,7 +446,7 @@ fn foo() { enum FooInner { } } | |||
446 | 5..13, | 446 | 5..13, |
447 | ), | 447 | ), |
448 | name: "FooInner", | 448 | name: "FooInner", |
449 | kind: ENUM_DEF, | 449 | kind: ENUM, |
450 | container_name: None, | 450 | container_name: None, |
451 | description: Some( | 451 | description: Some( |
452 | "enum FooInner", | 452 | "enum FooInner", |
@@ -462,7 +462,7 @@ fn foo() { enum FooInner { } } | |||
462 | 34..42, | 462 | 34..42, |
463 | ), | 463 | ), |
464 | name: "FooInner", | 464 | name: "FooInner", |
465 | kind: ENUM_DEF, | 465 | kind: ENUM, |
466 | container_name: Some( | 466 | container_name: Some( |
467 | "foo", | 467 | "foo", |
468 | ), | 468 | ), |
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 504b884c5..5bf70937f 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -25,7 +25,7 @@ impl ShortLabel for ast::Union { | |||
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | impl ShortLabel for ast::EnumDef { | 28 | impl ShortLabel for ast::Enum { |
29 | fn short_label(&self) -> Option<String> { | 29 | fn short_label(&self) -> Option<String> { |
30 | short_label_from_node(self, "enum ") | 30 | short_label_from_node(self, "enum ") |
31 | } | 31 | } |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 6f198fcbc..c909f96aa 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs | |||
@@ -128,7 +128,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
128 | }, | 128 | }, |
129 | ast::Struct(it) => decl(it), | 129 | ast::Struct(it) => decl(it), |
130 | ast::Union(it) => decl(it), | 130 | ast::Union(it) => decl(it), |
131 | ast::EnumDef(it) => decl(it), | 131 | ast::Enum(it) => decl(it), |
132 | ast::EnumVariant(it) => decl(it), | 132 | ast::EnumVariant(it) => decl(it), |
133 | ast::TraitDef(it) => decl(it), | 133 | ast::TraitDef(it) => decl(it), |
134 | ast::Module(it) => decl(it), | 134 | ast::Module(it) => decl(it), |
@@ -308,7 +308,7 @@ fn very_obsolete() {} | |||
308 | label: "E", | 308 | label: "E", |
309 | navigation_range: 165..166, | 309 | navigation_range: 165..166, |
310 | node_range: 160..180, | 310 | node_range: 160..180, |
311 | kind: ENUM_DEF, | 311 | kind: ENUM, |
312 | detail: None, | 312 | detail: None, |
313 | deprecated: false, | 313 | deprecated: false, |
314 | }, | 314 | }, |
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 699fad57d..e2f7e6373 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -45,7 +45,7 @@ fn impls_for_def( | |||
45 | ) -> Option<Vec<NavigationTarget>> { | 45 | ) -> Option<Vec<NavigationTarget>> { |
46 | let ty = match node { | 46 | let ty = match node { |
47 | ast::AdtDef::Struct(def) => sema.to_def(def)?.ty(sema.db), | 47 | ast::AdtDef::Struct(def) => sema.to_def(def)?.ty(sema.db), |
48 | ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db), | 48 | ast::AdtDef::Enum(def) => sema.to_def(def)?.ty(sema.db), |
49 | ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db), | 49 | ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db), |
50 | }; | 50 | }; |
51 | 51 | ||
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index ba1fd6242..7e2833bd5 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -706,7 +706,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | |||
706 | 706 | ||
707 | let tag = match parent.kind() { | 707 | let tag = match parent.kind() { |
708 | STRUCT => HighlightTag::Struct, | 708 | STRUCT => HighlightTag::Struct, |
709 | ENUM_DEF => HighlightTag::Enum, | 709 | ENUM => HighlightTag::Enum, |
710 | UNION => HighlightTag::Union, | 710 | UNION => HighlightTag::Union, |
711 | TRAIT_DEF => HighlightTag::Trait, | 711 | TRAIT_DEF => HighlightTag::Trait, |
712 | TYPE_ALIAS => HighlightTag::TypeAlias, | 712 | TYPE_ALIAS => HighlightTag::TypeAlias, |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 6a2180f6c..586b3d750 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -158,7 +158,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
158 | let def: hir::Union = sema.to_def(&it)?; | 158 | let def: hir::Union = sema.to_def(&it)?; |
159 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 159 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
160 | }, | 160 | }, |
161 | ast::EnumDef(it) => { | 161 | ast::Enum(it) => { |
162 | let def: hir::Enum = sema.to_def(&it)?; | 162 | let def: hir::Enum = sema.to_def(&it)?; |
163 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 163 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
164 | }, | 164 | }, |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index da19f0f33..646d338ae 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -344,7 +344,7 @@ impl Query { | |||
344 | } | 344 | } |
345 | 345 | ||
346 | fn is_type(kind: SyntaxKind) -> bool { | 346 | fn is_type(kind: SyntaxKind) -> bool { |
347 | matches!(kind, STRUCT | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS) | 347 | matches!(kind, STRUCT | ENUM | TRAIT_DEF | TYPE_ALIAS) |
348 | } | 348 | } |
349 | 349 | ||
350 | /// The actual data that is stored in the index. It should be as compact as | 350 | /// The actual data that is stored in the index. It should be as compact as |
@@ -399,7 +399,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { | |||
399 | match node { | 399 | match node { |
400 | ast::Fn(it) => decl(it), | 400 | ast::Fn(it) => decl(it), |
401 | ast::Struct(it) => decl(it), | 401 | ast::Struct(it) => decl(it), |
402 | ast::EnumDef(it) => decl(it), | 402 | ast::Enum(it) => decl(it), |
403 | ast::TraitDef(it) => decl(it), | 403 | ast::TraitDef(it) => decl(it), |
404 | ast::Module(it) => decl(it), | 404 | ast::Module(it) => decl(it), |
405 | ast::TypeAlias(it) => decl(it), | 405 | ast::TypeAlias(it) => decl(it), |
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 21af06e73..707e84f42 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -1467,7 +1467,7 @@ macro_rules! quick_error { | |||
1467 | buf [ ] | 1467 | buf [ ] |
1468 | queue [ ] | 1468 | queue [ ] |
1469 | ) => { | 1469 | ) => { |
1470 | quick_error!(ENUM_DEFINITION [enum $name $( #[$meta] )*] | 1470 | quick_error!(ENUMINITION [enum $name $( #[$meta] )*] |
1471 | body [] | 1471 | body [] |
1472 | queue [$( | 1472 | queue [$( |
1473 | $( #[$imeta] )* | 1473 | $( #[$imeta] )* |
@@ -1489,7 +1489,7 @@ quick_error ! (SORT [enum Wrapped # [derive (Debug)]] items [ | |||
1489 | "#, | 1489 | "#, |
1490 | ); | 1490 | ); |
1491 | 1491 | ||
1492 | assert_eq!(expanded.to_string(), "quick_error ! (ENUM_DEFINITION [enum Wrapped # [derive (Debug)]] body [] queue [=> One : UNIT [] => Two : TUPLE [s : String]]) ;"); | 1492 | assert_eq!(expanded.to_string(), "quick_error ! (ENUMINITION [enum Wrapped # [derive (Debug)]] body [] queue [=> One : UNIT [] => Two : TUPLE [s : String]]) ;"); |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | #[test] | 1495 | #[test] |
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index 2f5cfb6b6..aeb7ce86b 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs | |||
@@ -64,7 +64,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) { | |||
64 | } else { | 64 | } else { |
65 | p.error("expected `{`") | 65 | p.error("expected `{`") |
66 | } | 66 | } |
67 | m.complete(p, ENUM_DEF); | 67 | m.complete(p, ENUM); |
68 | } | 68 | } |
69 | 69 | ||
70 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 70 | pub(crate) fn enum_variant_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 4fad765c7..fde9e55f1 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -125,7 +125,7 @@ pub enum SyntaxKind { | |||
125 | SOURCE_FILE, | 125 | SOURCE_FILE, |
126 | STRUCT, | 126 | STRUCT, |
127 | UNION, | 127 | UNION, |
128 | ENUM_DEF, | 128 | ENUM, |
129 | FN, | 129 | FN, |
130 | RET_TYPE, | 130 | RET_TYPE, |
131 | EXTERN_CRATE, | 131 | EXTERN_CRATE, |
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)] |
47 | pub struct EnumDef { | 47 | pub struct Enum { |
48 | pub(crate) syntax: SyntaxNode, | 48 | pub(crate) syntax: SyntaxNode, |
49 | } | 49 | } |
50 | impl ast::AttrsOwner for EnumDef {} | 50 | impl ast::AttrsOwner for Enum {} |
51 | impl ast::NameOwner for EnumDef {} | 51 | impl ast::NameOwner for Enum {} |
52 | impl ast::VisibilityOwner for EnumDef {} | 52 | impl ast::VisibilityOwner for Enum {} |
53 | impl ast::GenericParamsOwner for EnumDef {} | 53 | impl ast::GenericParamsOwner for Enum {} |
54 | impl EnumDef { | 54 | impl 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)] |
1274 | pub enum Item { | 1274 | pub 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)] |
1393 | pub enum AdtDef { | 1393 | pub enum AdtDef { |
1394 | Struct(Struct), | 1394 | Struct(Struct), |
1395 | EnumDef(EnumDef), | 1395 | Enum(Enum), |
1396 | Union(Union), | 1396 | Union(Union), |
1397 | } | 1397 | } |
1398 | impl ast::AttrsOwner for AdtDef {} | 1398 | impl 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 | } |
1435 | impl AstNode for EnumDef { | 1435 | impl 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 { | |||
2777 | impl From<ConstDef> for Item { | 2777 | impl From<ConstDef> for Item { |
2778 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } | 2778 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } |
2779 | } | 2779 | } |
2780 | impl From<EnumDef> for Item { | 2780 | impl From<Enum> for Item { |
2781 | fn from(node: EnumDef) -> Item { Item::EnumDef(node) } | 2781 | fn from(node: Enum) -> Item { Item::Enum(node) } |
2782 | } | 2782 | } |
2783 | impl From<ExternBlock> for Item { | 2783 | impl 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 { | |||
2819 | impl AstNode for Item { | 2819 | 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 | 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 { | |||
3375 | impl From<Struct> for AdtDef { | 3375 | impl From<Struct> for AdtDef { |
3376 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } | 3376 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } |
3377 | } | 3377 | } |
3378 | impl From<EnumDef> for AdtDef { | 3378 | impl From<Enum> for AdtDef { |
3379 | fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } | 3379 | fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } |
3380 | } | 3380 | } |
3381 | impl From<Union> for AdtDef { | 3381 | impl 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 { | |||
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 | 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 | } |
3473 | impl std::fmt::Display for EnumDef { | 3473 | impl 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 | ||
250 | impl ast::EnumVariant { | 250 | impl 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 {} | |||
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 {} |
482 | impl ast::DocCommentsOwner for ast::EnumDef {} | 482 | impl ast::DocCommentsOwner for ast::Enum {} |
483 | impl ast::DocCommentsOwner for ast::EnumVariant {} | 483 | impl ast::DocCommentsOwner for ast::EnumVariant {} |
484 | impl ast::DocCommentsOwner for ast::TraitDef {} | 484 | impl ast::DocCommentsOwner for ast::TraitDef {} |
485 | impl ast::DocCommentsOwner for ast::Module {} | 485 | impl 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(); |
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 a1258028d..94456e48c 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast | |||
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | ENUM_DEF@16..152 | 14 | [email protected] |
15 | [email protected] "enum" | 15 | [email protected] "enum" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -79,7 +79,7 @@ [email protected] | |||
79 | [email protected] "1" | 79 | [email protected] "1" |
80 | [email protected] ";" | 80 | [email protected] ";" |
81 | [email protected] "\n " | 81 | [email protected] "\n " |
82 | ENUM_DEF@191..223 | 82 | [email protected] |
83 | [email protected] "enum" | 83 | [email protected] "enum" |
84 | [email protected] " " | 84 | [email protected] " " |
85 | [email protected] | 85 | [email protected] |
@@ -95,7 +95,7 @@ [email protected] | |||
95 | [email protected] "\n " | 95 | [email protected] "\n " |
96 | [email protected] "}" | 96 | [email protected] "}" |
97 | [email protected] "\n\n " | 97 | [email protected] "\n\n " |
98 | ENUM_DEF@229..300 | 98 | [email protected] |
99 | [email protected] "enum" | 99 | [email protected] "enum" |
100 | [email protected] " " | 100 | [email protected] " " |
101 | [email protected] | 101 | [email protected] |
@@ -132,7 +132,7 @@ [email protected] | |||
132 | [email protected] | 132 | [email protected] |
133 | [email protected] "{" | 133 | [email protected] "{" |
134 | [email protected] "\n " | 134 | [email protected] "\n " |
135 | ENUM_DEF@316..453 | 135 | [email protected] |
136 | [email protected] "// fail again" | 136 | [email protected] "// fail again" |
137 | [email protected] "\n " | 137 | [email protected] "\n " |
138 | [email protected] "enum" | 138 | [email protected] "enum" |
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 ea54347fc..25e6cc170 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 | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..8 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
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 280f947ce..9cc8172e0 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 | |||
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | ENUM_DEF@27..75 | 14 | [email protected] |
15 | [email protected] "enum" | 15 | [email protected] "enum" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
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 289fdfd6d..0331558d2 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 | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
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 1a32d88fd..1ffcffc1a 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -10,7 +10,7 @@ [email protected] | |||
10 | [email protected] "\n" | 10 | [email protected] "\n" |
11 | [email protected] "}" | 11 | [email protected] "}" |
12 | [email protected] "\n\n" | 12 | [email protected] "\n\n" |
13 | ENUM_DEF@13..27 | 13 | [email protected] |
14 | [email protected] "enum" | 14 | [email protected] "enum" |
15 | [email protected] " " | 15 | [email protected] " " |
16 | [email protected] | 16 | [email protected] |
@@ -27,7 +27,7 @@ [email protected] | |||
27 | [email protected] "\n" | 27 | [email protected] "\n" |
28 | [email protected] "}" | 28 | [email protected] "}" |
29 | [email protected] "\n\n" | 29 | [email protected] "\n\n" |
30 | ENUM_DEF@29..46 | 30 | [email protected] |
31 | [email protected] "enum" | 31 | [email protected] "enum" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | [email protected] |
@@ -42,7 +42,7 @@ [email protected] | |||
42 | [email protected] "\n" | 42 | [email protected] "\n" |
43 | [email protected] "}" | 43 | [email protected] "}" |
44 | [email protected] "\n\n" | 44 | [email protected] "\n\n" |
45 | ENUM_DEF@48..66 | 45 | [email protected] |
46 | [email protected] "enum" | 46 | [email protected] "enum" |
47 | [email protected] " " | 47 | [email protected] " " |
48 | [email protected] | 48 | [email protected] |
@@ -58,7 +58,7 @@ [email protected] | |||
58 | [email protected] "\n" | 58 | [email protected] "\n" |
59 | [email protected] "}" | 59 | [email protected] "}" |
60 | [email protected] "\n\n" | 60 | [email protected] "\n\n" |
61 | ENUM_DEF@68..181 | 61 | [email protected] |
62 | [email protected] "enum" | 62 | [email protected] "enum" |
63 | [email protected] " " | 63 | [email protected] " " |
64 | [email protected] | 64 | [email protected] |
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 fcf605ec8..9db4f0aa1 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 | |||
@@ -256,7 +256,7 @@ [email protected] | |||
256 | [email protected] "\n" | 256 | [email protected] "\n" |
257 | [email protected] "}" | 257 | [email protected] "}" |
258 | [email protected] "\n\n" | 258 | [email protected] "\n\n" |
259 | ENUM_DEF@343..367 | 259 | [email protected] |
260 | [email protected] "enum" | 260 | [email protected] "enum" |
261 | [email protected] " " | 261 | [email protected] " " |
262 | [email protected] | 262 | [email protected] |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index cb11dffd0..df4969b80 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -926,7 +926,7 @@ pub(crate) fn handle_code_lens( | |||
926 | it.kind, | 926 | it.kind, |
927 | SyntaxKind::TRAIT_DEF | 927 | SyntaxKind::TRAIT_DEF |
928 | | SyntaxKind::STRUCT | 928 | | SyntaxKind::STRUCT |
929 | | SyntaxKind::ENUM_DEF | 929 | | SyntaxKind::ENUM |
930 | | SyntaxKind::UNION | 930 | | SyntaxKind::UNION |
931 | ) | 931 | ) |
932 | }) | 932 | }) |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index a09a74c41..62acbfb91 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -33,7 +33,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { | |||
33 | match syntax_kind { | 33 | match syntax_kind { |
34 | SyntaxKind::FN => lsp_types::SymbolKind::Function, | 34 | SyntaxKind::FN => lsp_types::SymbolKind::Function, |
35 | SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, | 35 | SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, |
36 | SyntaxKind::ENUM_DEF => lsp_types::SymbolKind::Enum, | 36 | SyntaxKind::ENUM => lsp_types::SymbolKind::Enum, |
37 | SyntaxKind::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, | 37 | SyntaxKind::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, |
38 | SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, | 38 | SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, |
39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, | 39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index e8a90636e..fe8381e41 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -95,7 +95,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
95 | "SOURCE_FILE", | 95 | "SOURCE_FILE", |
96 | "STRUCT", | 96 | "STRUCT", |
97 | "UNION", | 97 | "UNION", |
98 | "ENUM_DEF", | 98 | "ENUM", |
99 | "FN", | 99 | "FN", |
100 | "RET_TYPE", | 100 | "RET_TYPE", |
101 | "EXTERN_CRATE", | 101 | "EXTERN_CRATE", |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index d038c5c5a..9c6797cb7 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -5,7 +5,7 @@ SourceFile = | |||
5 | 5 | ||
6 | Item = | 6 | Item = |
7 | ConstDef | 7 | ConstDef |
8 | | EnumDef | 8 | | Enum |
9 | | ExternBlock | 9 | | ExternBlock |
10 | | ExternCrate | 10 | | ExternCrate |
11 | | Fn | 11 | | Fn |
@@ -98,11 +98,7 @@ FieldList = | |||
98 | RecordFieldList | 98 | RecordFieldList |
99 | | TupleFieldList | 99 | | TupleFieldList |
100 | 100 | ||
101 | Union = | 101 | Enum = |
102 | Attr* Visibility? 'union' Name GenericParamList? WhereClause? | ||
103 | RecordFieldList | ||
104 | |||
105 | EnumDef = | ||
106 | Attr* Visibility? 'enum' Name GenericParamList? WhereClause? | 102 | Attr* Visibility? 'enum' Name GenericParamList? WhereClause? |
107 | variant_list:EnumVariantList | 103 | variant_list:EnumVariantList |
108 | 104 | ||
@@ -112,6 +108,10 @@ EnumVariantList = | |||
112 | EnumVariant = | 108 | EnumVariant = |
113 | Attr* Visibility? Name FieldList ('=' Expr)? | 109 | Attr* Visibility? Name FieldList ('=' Expr)? |
114 | 110 | ||
111 | Union = | ||
112 | Attr* Visibility? 'union' Name GenericParamList? WhereClause? | ||
113 | RecordFieldList | ||
114 | |||
115 | TraitDef = | 115 | TraitDef = |
116 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList | 116 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList |
117 | (':' TypeBoundList?)? WhereClause | 117 | (':' TypeBoundList?)? WhereClause |
@@ -454,7 +454,7 @@ MetaItem = | |||
454 | 454 | ||
455 | AdtDef = | 455 | AdtDef = |
456 | Struct | 456 | Struct |
457 | | EnumDef | 457 | | Enum |
458 | | Union | 458 | | Union |
459 | 459 | ||
460 | TypeRef = | 460 | TypeRef = |