diff --git a/crates/ra_ide/src/imports_locator.rs b/crates/ra_ide/src/imports_locator.rs index cfd58aafeb5..23bf43b07bf 100644 --- a/crates/ra_ide/src/imports_locator.rs +++ b/crates/ra_ide/src/imports_locator.rs @@ -11,7 +11,7 @@ use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; use crate::{ - references::{classify_name, NameDefinition, NameKind}, + references::{classify_name, NameKind}, Query, }; @@ -28,7 +28,7 @@ fn get_name_definition( &mut self, db: &impl HirDatabase, import_candidate: &FileSymbol, - ) -> Option { + ) -> Option { let _p = profile("get_name_definition"); let file_id = import_candidate.file_id.into(); let candidate_node = import_candidate.ptr.to_node(&db.parse_or_expand(file_id)?); @@ -41,6 +41,7 @@ fn get_name_definition( &mut self.source_binder, hir::InFile { file_id, value: &ast::Name::cast(candidate_name_node)? }, ) + .map(|it| it.kind) } } @@ -67,7 +68,7 @@ fn find_imports(&mut self, name_to_import: &str) -> Vec { .into_iter() .chain(lib_results.into_iter()) .filter_map(|import_candidate| self.get_name_definition(db, &import_candidate)) - .filter_map(|name_definition_to_import| match name_definition_to_import.kind { + .filter_map(|name_definition_to_import| match name_definition_to_import { NameKind::Def(module_def) => Some(module_def), _ => None, })