Skip to content

Commit dc49f88

Browse files
bors[bot]matklad
andauthored
Merge #5583
5583: Rename Rename r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 74864d5 + 026e4e6 commit dc49f88

File tree

14 files changed

+34
-30
lines changed

14 files changed

+34
-30
lines changed

crates/ra_assists/src/utils/insert_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn walk_use_tree_for_best_action(
215215
let prev_len = current_path_segments.len();
216216

217217
let tree_list = current_use_tree.use_tree_list();
218-
let alias = current_use_tree.alias();
218+
let alias = current_use_tree.rename();
219219

220220
let path = match current_use_tree.path() {
221221
Some(path) => path,

crates/ra_hir_def/src/item_tree/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ impl Ctx {
501501
extern_crate: &ast::ExternCrateItem,
502502
) -> Option<FileItemTreeId<ExternCrate>> {
503503
let path = ModPath::from_name_ref(&extern_crate.name_ref()?);
504-
let alias = extern_crate.alias().map(|a| {
504+
let alias = extern_crate.rename().map(|a| {
505505
a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias)
506506
});
507507
let visibility = self.lower_visibility(extern_crate);

crates/ra_hir_def/src/path/lower/lower_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) fn lower_use_tree(
3131
lower_use_tree(prefix.clone(), child_tree, hygiene, cb);
3232
}
3333
} else {
34-
let alias = tree.alias().map(|a| {
34+
let alias = tree.rename().map(|a| {
3535
a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias)
3636
});
3737
let is_glob = tree.star_token().is_some();

crates/ra_ide_db/src/defs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
119119

120120
match_ast! {
121121
match parent {
122-
ast::Alias(it) => {
122+
ast::Rename(it) => {
123123
let use_tree = it.syntax().parent().and_then(ast::UseTree::cast)?;
124124
let path = use_tree.path()?;
125125
let path_segment = path.segment()?;

crates/ra_parser/src/grammar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn opt_alias(p: &mut Parser) {
224224
if !p.eat(T![_]) {
225225
name(p);
226226
}
227-
m.complete(p, ALIAS);
227+
m.complete(p, RENAME);
228228
}
229229
}
230230

crates/ra_parser/src/syntax_kind/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub enum SyntaxKind {
221221
PATH,
222222
PATH_SEGMENT,
223223
LITERAL,
224-
ALIAS,
224+
RENAME,
225225
VISIBILITY,
226226
WHERE_CLAUSE,
227227
WHERE_PRED,

crates/ra_syntax/src/ast/edit.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,12 @@ impl ast::UseTree {
317317
Some(it) => it,
318318
None => return self.clone(),
319319
};
320-
let use_tree =
321-
make::use_tree(suffix, self.use_tree_list(), self.alias(), self.star_token().is_some());
320+
let use_tree = make::use_tree(
321+
suffix,
322+
self.use_tree_list(),
323+
self.rename(),
324+
self.star_token().is_some(),
325+
);
322326
let nested = make::use_tree_list(iter::once(use_tree));
323327
return make::use_tree(prefix.clone(), Some(nested), None, false);
324328

crates/ra_syntax/src/ast/generated/nodes.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl ExternCrateItem {
7575
pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
7676
pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
7777
pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
78-
pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
78+
pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
7979
pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
8080
}
8181
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1178,7 +1178,7 @@ impl UseTree {
11781178
pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
11791179
pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
11801180
pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
1181-
pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
1181+
pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
11821182
}
11831183
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
11841184
pub struct UseTreeList {
@@ -1190,11 +1190,11 @@ impl UseTreeList {
11901190
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
11911191
}
11921192
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1193-
pub struct Alias {
1193+
pub struct Rename {
11941194
pub(crate) syntax: SyntaxNode,
11951195
}
1196-
impl ast::NameOwner for Alias {}
1197-
impl Alias {
1196+
impl ast::NameOwner for Rename {}
1197+
impl Rename {
11981198
pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
11991199
}
12001200
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2683,8 +2683,8 @@ impl AstNode for UseTreeList {
26832683
}
26842684
fn syntax(&self) -> &SyntaxNode { &self.syntax }
26852685
}
2686-
impl AstNode for Alias {
2687-
fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS }
2686+
impl AstNode for Rename {
2687+
fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME }
26882688
fn cast(syntax: SyntaxNode) -> Option<Self> {
26892689
if Self::can_cast(syntax.kind()) {
26902690
Some(Self { syntax })
@@ -4040,7 +4040,7 @@ impl std::fmt::Display for UseTreeList {
40404040
std::fmt::Display::fmt(self.syntax(), f)
40414041
}
40424042
}
4043-
impl std::fmt::Display for Alias {
4043+
impl std::fmt::Display for Rename {
40444044
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40454045
std::fmt::Display::fmt(self.syntax(), f)
40464046
}

crates/ra_syntax/src/ast/make.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn path_from_text(text: &str) -> ast::Path {
3737
pub fn use_tree(
3838
path: ast::Path,
3939
use_tree_list: Option<ast::UseTreeList>,
40-
alias: Option<ast::Alias>,
40+
alias: Option<ast::Rename>,
4141
add_star: bool,
4242
) -> ast::UseTree {
4343
let mut buf = "use ".to_string();

crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ [email protected]
1313
1414
1515
16-
ALIAS@15..27
16+
RENAME@15..27
1717
1818
1919
@@ -43,7 +43,7 @@ [email protected]
4343
4444
4545
46-
ALIAS@54..72
46+
RENAME@54..72
4747
4848
4949
@@ -61,7 +61,7 @@ [email protected]
6161
6262
6363
64-
ALIAS@91..108
64+
RENAME@91..108
6565
6666
6767
@@ -130,7 +130,7 @@ [email protected]
130130
131131
132132
133-
ALIAS@192..196
133+
RENAME@192..196
134134
135135
136136

crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ [email protected]
1616
1717
1818
19-
ALIAS@35..41
19+
RENAME@35..41
2020
2121
2222
@@ -30,7 +30,7 @@ [email protected]
3030
3131
3232
33-
ALIAS@61..67
33+
RENAME@61..67
3434
3535
3636

crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ [email protected]
88
99
1010
11-
ALIAS@8..14
11+
RENAME@8..14
1212
1313
1414
@@ -32,7 +32,7 @@ [email protected]
3232
3333
3434
35-
ALIAS@28..32
35+
RENAME@28..32
3636
3737
3838
@@ -55,7 +55,7 @@ [email protected]
5555
5656
5757
58-
ALIAS@48..52
58+
RENAME@48..52
5959
6060
6161

xtask/src/ast_src.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
194194
"PATH",
195195
"PATH_SEGMENT",
196196
"LITERAL",
197-
"ALIAS",
197+
"RENAME",
198198
"VISIBILITY",
199199
"WHERE_CLAUSE",
200200
"WHERE_PRED",

xtask/src/codegen/rust.ungram

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,16 @@ UseItem =
396396
Attr* Visibility? 'use' UseTree ';'
397397

398398
UseTree =
399-
Path ('::' ('*' | UseTreeList)) Alias?
399+
Path ('::' ('*' | UseTreeList)) Rename?
400400

401401
UseTreeList =
402402
'{' UseTree* '}'
403403

404-
Alias =
404+
Rename =
405405
'as' Name
406406

407407
ExternCrateItem =
408-
Attr* Visibility? 'extern' 'crate' (NameRef | 'self') Alias? ';'
408+
Attr* Visibility? 'extern' 'crate' (NameRef | 'self') Rename? ';'
409409

410410
Path =
411411
(qualifier:Path '::')? segment:PathSegment

0 commit comments

Comments
 (0)