Skip to content

Commit eb2f806

Browse files
committed
Rename TypeAliasDef -> TypeAlias
1 parent 1142112 commit eb2f806

File tree

65 files changed

+146
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+146
-155
lines changed

crates/ra_assists/src/handlers/add_missing_impl_members.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn add_missing_impl_members_inner(
119119
let def_name = |item: &ast::AssocItem| -> Option<SmolStr> {
120120
match item {
121121
ast::AssocItem::Fn(def) => def.name(),
122-
ast::AssocItem::TypeAliasDef(def) => def.name(),
122+
ast::AssocItem::TypeAlias(def) => def.name(),
123123
ast::AssocItem::ConstDef(def) => def.name(),
124124
ast::AssocItem::MacroCall(_) => None,
125125
}
@@ -130,7 +130,7 @@ fn add_missing_impl_members_inner(
130130
.iter()
131131
.map(|i| match i {
132132
hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value),
133-
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value),
133+
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value),
134134
hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value),
135135
})
136136
.filter(|t| def_name(&t).is_some())
@@ -159,9 +159,7 @@ fn add_missing_impl_members_inner(
159159
.map(|it| ast_transform::apply(&*ast_transform, it))
160160
.map(|it| match it {
161161
ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)),
162-
ast::AssocItem::TypeAliasDef(def) => {
163-
ast::AssocItem::TypeAliasDef(def.remove_bounds())
164-
}
162+
ast::AssocItem::TypeAlias(def) => ast::AssocItem::TypeAlias(def.remove_bounds()),
165163
_ => it,
166164
})
167165
.map(|it| edit::remove_attrs_and_docs(&it));

crates/ra_assists/src/handlers/change_visibility.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use ra_syntax::{
22
ast::{self, NameOwner, VisibilityOwner},
33
AstNode,
4-
SyntaxKind::{
5-
CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
6-
},
4+
SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY},
75
T,
86
};
97
use test_utils::mark;

crates/ra_assists/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn get_missing_assoc_items(
7272
}
7373
}
7474

75-
ast::AssocItem::TypeAliasDef(t) => {
75+
ast::AssocItem::TypeAlias(t) => {
7676
if let Some(n) = t.name() {
7777
impl_type.insert(n.syntax().to_string());
7878
}

crates/ra_hir/src/has_source.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ impl HasSource for Trait {
105105
}
106106
}
107107
impl HasSource for TypeAlias {
108-
type Ast = ast::TypeAliasDef;
109-
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAliasDef> {
108+
type Ast = ast::TypeAlias;
109+
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> {
110110
self.id.lookup(db.upcast()).source(db.upcast())
111111
}
112112
}

crates/ra_hir/src/semantics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ to_def_impls![
582582
(crate::Union, ast::UnionDef, union_to_def),
583583
(crate::Trait, ast::TraitDef, trait_to_def),
584584
(crate::ImplDef, ast::ImplDef, impl_to_def),
585-
(crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def),
585+
(crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
586586
(crate::Const, ast::ConstDef, const_to_def),
587587
(crate::Static, ast::StaticDef, static_to_def),
588588
(crate::Function, ast::Fn, fn_to_def),

crates/ra_hir/src/semantics/source_to_def.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ impl SourceToDefCtx<'_, '_> {
8989
pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> {
9090
self.to_def(src, keys::CONST)
9191
}
92-
pub(super) fn type_alias_to_def(
93-
&mut self,
94-
src: InFile<ast::TypeAliasDef>,
95-
) -> Option<TypeAliasId> {
92+
pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
9693
self.to_def(src, keys::TYPE_ALIAS)
9794
}
9895
pub(super) fn record_field_to_def(
@@ -195,7 +192,7 @@ impl SourceToDefCtx<'_, '_> {
195192
let def = self.const_to_def(container.with_value(it))?;
196193
DefWithBodyId::from(def).into()
197194
},
198-
ast::TypeAliasDef(it) => {
195+
ast::TypeAlias(it) => {
199196
let def = self.type_alias_to_def(container.with_value(it))?;
200197
def.into()
201198
},
@@ -217,7 +214,7 @@ impl SourceToDefCtx<'_, '_> {
217214
ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
218215
ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
219216
ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
220-
ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(),
217+
ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
221218
ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
222219
_ => continue,
223220
}

crates/ra_hir_def/src/body/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ impl ExprCollector<'_> {
634634
def.name(),
635635
)
636636
}
637-
ast::Item::TypeAliasDef(def) => {
637+
ast::Item::TypeAlias(def) => {
638638
let id = self.find_inner_item(&def)?;
639639
(
640640
TypeAliasLoc { container: container.into(), id }.intern(self.db).into(),

crates/ra_hir_def/src/item_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ mod_items! {
421421
Static in statics -> ast::StaticDef,
422422
Trait in traits -> ast::TraitDef,
423423
Impl in impls -> ast::ImplDef,
424-
TypeAlias in type_aliases -> ast::TypeAliasDef,
424+
TypeAlias in type_aliases -> ast::TypeAlias,
425425
Mod in mods -> ast::Module,
426426
MacroCall in macro_calls -> ast::MacroCall,
427427
}
@@ -592,7 +592,7 @@ pub struct TypeAlias {
592592
pub bounds: Box<[TypeBound]>,
593593
pub generic_params: GenericParamsId,
594594
pub type_ref: Option<TypeRef>,
595-
pub ast_id: FileAstId<ast::TypeAliasDef>,
595+
pub ast_id: FileAstId<ast::TypeAlias>,
596596
}
597597

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

crates/ra_hir_def/src/item_tree/lower.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Ctx {
7979
| ast::Item::UnionDef(_)
8080
| ast::Item::EnumDef(_)
8181
| ast::Item::Fn(_)
82-
| ast::Item::TypeAliasDef(_)
82+
| ast::Item::TypeAlias(_)
8383
| ast::Item::ConstDef(_)
8484
| ast::Item::StaticDef(_)
8585
| ast::Item::MacroCall(_) => {
@@ -104,7 +104,7 @@ impl Ctx {
104104
ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into),
105105
ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
106106
ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
107-
ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
107+
ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
108108
ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into),
109109
ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()),
110110
ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
@@ -156,7 +156,7 @@ impl Ctx {
156156
fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> {
157157
match item {
158158
ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into),
159-
ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
159+
ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
160160
ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()),
161161
ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
162162
}
@@ -348,7 +348,7 @@ impl Ctx {
348348

349349
fn lower_type_alias(
350350
&mut self,
351-
type_alias: &ast::TypeAliasDef,
351+
type_alias: &ast::TypeAlias,
352352
) -> Option<FileItemTreeId<TypeAlias>> {
353353
let name = type_alias.name()?.as_name();
354354
let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it));

crates/ra_hir_def/src/item_tree/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fn smoke() {
236236
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
237237
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) }
238238
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
239-
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAliasDef>(8) }
239+
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) }
240240
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
241241
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) }
242242
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }]

0 commit comments

Comments
 (0)