aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-23 09:49:55 +0000
committerAleksey Kladov <[email protected]>2021-03-23 09:49:55 +0000
commit45a8f37b6ae230db6c30c013f17d8aebac98a5e1 (patch)
treeddd1d23321319816f932551c0d8b0c42e590e40b /crates/ide_db/src
parent4b997b86633b1c0ca134d89e8236d285422c04e3 (diff)
Compute more mathematically well-rounded notion of transitive deps
By including the crate itself, we make the resulting set closed with respect to `transitve_reveres_dependencies` operation, as it becomes a proper transitive closure. This just feels more proper and mathy. And, indeed, this actually allows us to simplify call sites somewhat.
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r--crates/ide_db/src/search.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index 324817cd0..8e93de277 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -245,9 +245,7 @@ impl Definition {
245 } 245 }
246 246
247 if let Some(Visibility::Public) = vis { 247 if let Some(Visibility::Public) = vis {
248 let source_root_id = db.file_source_root(file_id); 248 let mut res = FxHashMap::default();
249 let source_root = db.source_root(source_root_id);
250 let mut res = source_root.iter().map(|id| (id, None)).collect::<FxHashMap<_, _>>();
251 249
252 let krate = module.krate(); 250 let krate = module.krate();
253 for rev_dep in krate.transitive_reverse_dependencies(db) { 251 for rev_dep in krate.transitive_reverse_dependencies(db) {