Skip to content

Commit 8de0eb9

Browse files
bors[bot]matklad
andauthored
Merge #5603
5603: Rename EnumDef -> Enum r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 97df465 + 609680e commit 8de0eb9

File tree

35 files changed

+83
-83
lines changed

35 files changed

+83
-83
lines changed

crates/ra_assists/src/handlers/change_visibility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use ra_syntax::{
22
ast::{self, NameOwner, VisibilityOwner},
33
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},
55
T,
66
};
77
use test_utils::mark;
@@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
3636

3737
let (offset, target) = if let Some(keyword) = item_keyword {
3838
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];
4040
// Parent is not a definition, can't add visibility
4141
if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) {
4242
return None;

crates/ra_assists/src/handlers/move_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
4040
ast::Fn(it) => it.body()?.syntax().clone().into(),
4141
ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(),
4242
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(),
4444
ast::Struct(it) => {
4545
it.syntax().children_with_tokens()
4646
.find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])?

crates/ra_hir/src/has_source.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl HasSource for Union {
6969
}
7070
}
7171
impl HasSource for Enum {
72-
type Ast = ast::EnumDef;
73-
fn source(self, db: &dyn HirDatabase) -> InFile<ast::EnumDef> {
72+
type Ast = ast::Enum;
73+
fn source(self, db: &dyn HirDatabase) -> InFile<ast::Enum> {
7474
self.id.lookup(db.upcast()).source(db.upcast())
7575
}
7676
}

crates/ra_hir/src/semantics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ macro_rules! to_def_impls {
581581
to_def_impls![
582582
(crate::Module, ast::Module, module_to_def),
583583
(crate::Struct, ast::Struct, struct_to_def),
584-
(crate::Enum, ast::EnumDef, enum_to_def),
584+
(crate::Enum, ast::Enum, enum_to_def),
585585
(crate::Union, ast::Union, union_to_def),
586586
(crate::Trait, ast::TraitDef, trait_to_def),
587587
(crate::ImplDef, ast::ImplDef, impl_to_def),

crates/ra_hir/src/semantics/source_to_def.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl SourceToDefCtx<'_, '_> {
7777
pub(super) fn struct_to_def(&mut self, src: InFile<ast::Struct>) -> Option<StructId> {
7878
self.to_def(src, keys::STRUCT)
7979
}
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> {
8181
self.to_def(src, keys::ENUM)
8282
}
8383
pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> {
@@ -170,7 +170,7 @@ impl SourceToDefCtx<'_, '_> {
170170
let def = self.struct_to_def(container.with_value(it))?;
171171
VariantId::from(def).into()
172172
},
173-
ast::EnumDef(it) => {
173+
ast::Enum(it) => {
174174
let def = self.enum_to_def(container.with_value(it))?;
175175
def.into()
176176
},
@@ -206,7 +206,7 @@ impl SourceToDefCtx<'_, '_> {
206206
match (container.value) {
207207
ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
208208
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(),
210210
ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
211211
ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
212212
ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),

crates/ra_hir_def/src/adt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl HasChildSource for EnumId {
124124
fn lower_enum(
125125
db: &dyn DefDatabase,
126126
trace: &mut Trace<EnumVariantData, ast::EnumVariant>,
127-
ast: &InFile<ast::EnumDef>,
127+
ast: &InFile<ast::Enum>,
128128
module_id: ModuleId,
129129
) {
130130
let expander = CfgExpander::new(db, ast.file_id, module_id.krate);

crates/ra_hir_def/src/body/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl ExprCollector<'_> {
656656
let id = self.find_inner_item(&def)?;
657657
(StructLoc { container, id }.intern(self.db).into(), def.name())
658658
}
659-
ast::Item::EnumDef(def) => {
659+
ast::Item::Enum(def) => {
660660
let id = self.find_inner_item(&def)?;
661661
(EnumLoc { container, id }.intern(self.db).into(), def.name())
662662
}

crates/ra_hir_def/src/item_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ mod_items! {
416416
Function in functions -> ast::Fn,
417417
Struct in structs -> ast::Struct,
418418
Union in unions -> ast::Union,
419-
Enum in enums -> ast::EnumDef,
419+
Enum in enums -> ast::Enum,
420420
Const in consts -> ast::ConstDef,
421421
Static in statics -> ast::StaticDef,
422422
Trait in traits -> ast::TraitDef,
@@ -543,7 +543,7 @@ pub struct Enum {
543543
pub visibility: RawVisibilityId,
544544
pub generic_params: GenericParamsId,
545545
pub variants: IdRange<Variant>,
546-
pub ast_id: FileAstId<ast::EnumDef>,
546+
pub ast_id: FileAstId<ast::Enum>,
547547
}
548548

549549
#[derive(Debug, Clone, Eq, PartialEq)]

crates/ra_hir_def/src/item_tree/lower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Ctx {
8080
match item {
8181
ast::Item::Struct(_)
8282
| ast::Item::Union(_)
83-
| ast::Item::EnumDef(_)
83+
| ast::Item::Enum(_)
8484
| ast::Item::Fn(_)
8585
| ast::Item::TypeAlias(_)
8686
| ast::Item::ConstDef(_)
@@ -105,7 +105,7 @@ impl Ctx {
105105
let items = match item {
106106
ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into),
107107
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),
109109
ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
110110
ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
111111
ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into),
@@ -246,7 +246,7 @@ impl Ctx {
246246
Some(id(self.data().unions.alloc(res)))
247247
}
248248

249-
fn lower_enum(&mut self, enum_: &ast::EnumDef) -> Option<FileItemTreeId<Enum>> {
249+
fn lower_enum(&mut self, enum_: &ast::Enum) -> Option<FileItemTreeId<Enum>> {
250250
let visibility = self.lower_visibility(enum_);
251251
let name = enum_.name()?.as_name();
252252
let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_);

crates/ra_hir_def/src/item_tree/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ fn smoke() {
250250
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }]
251251
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 }
252252
#[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) }
254254
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }]
255255
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) }
256256
"##]],

0 commit comments

Comments
 (0)