Do not process indexed values more than once

This commit is contained in:
Kirill Bulatov 2021-03-08 12:06:15 +02:00
parent 8f17f3d594
commit 128a6a4ec0

View file

@ -403,9 +403,14 @@ pub fn search_dependencies<'a>(
}
let mut stream = op.union();
let mut res = FxHashSet::default();
let mut all_indexed_values = FxHashSet::default();
while let Some((_, indexed_values)) = stream.next() {
for indexed_value in indexed_values {
all_indexed_values.extend(indexed_values.iter().copied());
}
let mut res = FxHashSet::default();
for indexed_value in all_indexed_values {
let import_map = &import_maps[indexed_value.index];
let importables = &import_map.importables[indexed_value.value as usize..];
@ -421,9 +426,7 @@ pub fn search_dependencies<'a>(
let iter = importables
.iter()
.copied()
.take_while(|item| {
common_importables_path_fst == fst_path(&import_map.map[item].path)
})
.take_while(|item| common_importables_path_fst == fst_path(&import_map.map[item].path))
.filter(|&item| match item_import_kind(item) {
Some(import_kind) => !query.exclude_import_kinds.contains(&import_kind),
None => true,
@ -438,7 +441,6 @@ pub fn search_dependencies<'a>(
return res;
}
}
}
res
}