From e88c3e4fcd5827e091a1cbc1b3d8ce4c67e09fe0 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Mon, 4 May 2020 13:41:41 +0200 Subject: [PATCH] refactor: use parent instead ancestors for use alias Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_ide_db/src/defs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index d5d06962bb5..40d0e77b5f4 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -121,7 +121,7 @@ fn classify_name_inner(sema: &Semantics, 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()?;