mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-24 12:03:31 +00:00
mark as visited on entry instead of left
This commit is contained in:
parent
0267df3815
commit
c0add813e9
1 changed files with 2 additions and 2 deletions
|
@ -118,9 +118,10 @@ impl CrateGraph {
|
|||
self.arena[&crate_id].dependencies.iter()
|
||||
}
|
||||
fn dfs_find(&self, target: CrateId, from: CrateId, visited: &mut FxHashSet<CrateId>) -> bool {
|
||||
if visited.contains(&from) {
|
||||
if !visited.insert(from) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for dep in self.dependencies(from) {
|
||||
let crate_id = dep.crate_id();
|
||||
if crate_id == target {
|
||||
|
@ -131,7 +132,6 @@ impl CrateGraph {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
visited.insert(from);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue