mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Do not process indexed values more than once
This commit is contained in:
parent
8f17f3d594
commit
128a6a4ec0
1 changed files with 31 additions and 29 deletions
|
@ -403,9 +403,14 @@ pub fn search_dependencies<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut stream = op.union();
|
let mut stream = op.union();
|
||||||
let mut res = FxHashSet::default();
|
|
||||||
|
let mut all_indexed_values = FxHashSet::default();
|
||||||
while let Some((_, indexed_values)) = stream.next() {
|
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 import_map = &import_maps[indexed_value.index];
|
||||||
let importables = &import_map.importables[indexed_value.value as usize..];
|
let importables = &import_map.importables[indexed_value.value as usize..];
|
||||||
|
|
||||||
|
@ -421,9 +426,7 @@ pub fn search_dependencies<'a>(
|
||||||
let iter = importables
|
let iter = importables
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
.take_while(|item| {
|
.take_while(|item| common_importables_path_fst == fst_path(&import_map.map[item].path))
|
||||||
common_importables_path_fst == fst_path(&import_map.map[item].path)
|
|
||||||
})
|
|
||||||
.filter(|&item| match item_import_kind(item) {
|
.filter(|&item| match item_import_kind(item) {
|
||||||
Some(import_kind) => !query.exclude_import_kinds.contains(&import_kind),
|
Some(import_kind) => !query.exclude_import_kinds.contains(&import_kind),
|
||||||
None => true,
|
None => true,
|
||||||
|
@ -438,7 +441,6 @@ pub fn search_dependencies<'a>(
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue