diff options
author | Aleksey Kladov <[email protected]> | 2019-12-08 11:01:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-08 11:02:53 +0000 |
commit | 08d3166c8b23b5a342f32e088f7e0d6e032ec17b (patch) | |
tree | b46a1eb2d61c81312912200f568239e61ce5a845 /crates/ra_ide/src/references | |
parent | ffcdd25cc8e7f1fd7fb4e3e8478c4cd1adfbf843 (diff) |
Cleanup Crate API
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r-- | crates/ra_ide/src/references/search_scope.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/ra_ide/src/references/search_scope.rs b/crates/ra_ide/src/references/search_scope.rs index f5c9589f4..241dd358f 100644 --- a/crates/ra_ide/src/references/search_scope.rs +++ b/crates/ra_ide/src/references/search_scope.rs | |||
@@ -5,7 +5,7 @@ | |||
5 | use std::mem; | 5 | use std::mem; |
6 | 6 | ||
7 | use hir::{DefWithBody, HasSource, ModuleSource}; | 7 | use hir::{DefWithBody, HasSource, ModuleSource}; |
8 | use ra_db::{FileId, SourceDatabase, SourceDatabaseExt}; | 8 | use ra_db::{FileId, SourceDatabaseExt}; |
9 | use ra_prof::profile; | 9 | use ra_prof::profile; |
10 | use ra_syntax::{AstNode, TextRange}; | 10 | use ra_syntax::{AstNode, TextRange}; |
11 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
@@ -120,15 +120,11 @@ impl NameDefinition { | |||
120 | } | 120 | } |
121 | if vis.as_str() == "pub" { | 121 | if vis.as_str() == "pub" { |
122 | let krate = self.container.krate(); | 122 | let krate = self.container.krate(); |
123 | let crate_graph = db.crate_graph(); | 123 | for rev_dep in krate.reverse_dependencies(db) { |
124 | for crate_id in crate_graph.iter() { | 124 | let root_file = rev_dep.root_file(db); |
125 | let mut crate_deps = crate_graph.dependencies(crate_id); | 125 | let source_root_id = db.file_source_root(root_file); |
126 | if crate_deps.any(|dep| dep.crate_id() == krate.crate_id()) { | 126 | let source_root = db.source_root(source_root_id); |
127 | let root_file = crate_graph.crate_root(crate_id); | 127 | res.extend(source_root.walk().map(|id| (id, None))); |
128 | let source_root_id = db.file_source_root(root_file); | ||
129 | let source_root = db.source_root(source_root_id); | ||
130 | res.extend(source_root.walk().map(|id| (id, None))); | ||
131 | } | ||
132 | } | 128 | } |
133 | return SearchScope::new(res); | 129 | return SearchScope::new(res); |
134 | } | 130 | } |