Merge #4297
4297: refactor: use parent instead ancestors for use alias r=matklad a=bnjjj Linked to this comment https://github.com/rust-analyzer/rust-analyzer/pull/4269/files#r419343670 Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
commit
580c5a969d
1 changed files with 1 additions and 1 deletions
|
@ -121,7 +121,7 @@ fn classify_name_inner(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Opti
|
|||
match parent {
|
||||
ast::Alias(it) => {
|
||||
tested_by!(goto_def_for_use_alias; force);
|
||||
let use_tree = it.syntax().ancestors().find_map(ast::UseTree::cast)?;
|
||||
let use_tree = it.syntax().parent().and_then(ast::UseTree::cast)?;
|
||||
let path = use_tree.path()?;
|
||||
let path_segment = path.segment()?;
|
||||
let name_ref = path_segment.name_ref()?;
|
||||
|
|
Loading…
Add table
Reference in a new issue