aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-22 22:19:55 +0000
committerKirill Bulatov <[email protected]>2020-03-24 08:43:00 +0000
commitd221ff4f9e0e270939a2944a2471bc3f027a674b (patch)
tree443bc8ad18e679fe12586153e9c2b35e3706628e /crates/ra_ide_db
parentf9494f114798f66b5f2174cf518a2951a82571d3 (diff)
Auto import macros
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r--crates/ra_ide_db/src/imports_locator.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ra_ide_db/src/imports_locator.rs
index c96351982..24b6e4ad0 100644
--- a/crates/ra_ide_db/src/imports_locator.rs
+++ b/crates/ra_ide_db/src/imports_locator.rs
@@ -1,7 +1,7 @@
1//! This module contains an import search funcionality that is provided to the ra_assists module. 1//! This module contains an import search funcionality that is provided to the ra_assists module.
2//! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. 2//! Later, this should be moved away to a separate crate that is accessible from the ra_assists module.
3 3
4use hir::{ModuleDef, Semantics}; 4use hir::Semantics;
5use ra_prof::profile; 5use ra_prof::profile;
6use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; 6use ra_syntax::{ast, AstNode, SyntaxKind::NAME};
7 7
@@ -20,7 +20,7 @@ impl<'a> ImportsLocator<'a> {
20 Self { sema: Semantics::new(db) } 20 Self { sema: Semantics::new(db) }
21 } 21 }
22 22
23 pub fn find_imports(&mut self, name_to_import: &str) -> Vec<ModuleDef> { 23 pub fn find_imports(&mut self, name_to_import: &str) -> Vec<Definition> {
24 let _p = profile("search_for_imports"); 24 let _p = profile("search_for_imports");
25 let db = self.sema.db; 25 let db = self.sema.db;
26 26
@@ -42,10 +42,6 @@ impl<'a> ImportsLocator<'a> {
42 .into_iter() 42 .into_iter()
43 .chain(lib_results.into_iter()) 43 .chain(lib_results.into_iter())
44 .filter_map(|import_candidate| self.get_name_definition(&import_candidate)) 44 .filter_map(|import_candidate| self.get_name_definition(&import_candidate))
45 .filter_map(|name_definition_to_import| match name_definition_to_import {
46 Definition::ModuleDef(module_def) => Some(module_def),
47 _ => None,
48 })
49 .collect() 45 .collect()
50 } 46 }
51 47