From 45a8f37b6ae230db6c30c013f17d8aebac98a5e1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 23 Mar 2021 12:49:55 +0300 Subject: 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. --- crates/ide_db/src/search.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crates/ide_db') 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 { } if let Some(Visibility::Public) = vis { - let source_root_id = db.file_source_root(file_id); - let source_root = db.source_root(source_root_id); - let mut res = source_root.iter().map(|id| (id, None)).collect::>(); + let mut res = FxHashMap::default(); let krate = module.krate(); for rev_dep in krate.transitive_reverse_dependencies(db) { -- cgit v1.2.3