aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/input.rs
diff options
context:
space:
mode:
authorgfreezy <[email protected]>2018-12-22 14:40:41 +0000
committergfreezy <[email protected]>2018-12-22 14:40:41 +0000
commitc0add813e9005a3356c7a8062c9a9c8f8bca6895 (patch)
treea49c18fab055e9ee2c3f86ee487247b2e995b77e /crates/ra_db/src/input.rs
parent0267df38156d5d67f0b636913a3fe54d84d906ab (diff)
mark as visited on entry instead of left
Diffstat (limited to 'crates/ra_db/src/input.rs')
-rw-r--r--crates/ra_db/src/input.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index e9a991a57..f445e03bc 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -118,9 +118,10 @@ impl CrateGraph {
118 self.arena[&crate_id].dependencies.iter() 118 self.arena[&crate_id].dependencies.iter()
119 } 119 }
120 fn dfs_find(&self, target: CrateId, from: CrateId, visited: &mut FxHashSet<CrateId>) -> bool { 120 fn dfs_find(&self, target: CrateId, from: CrateId, visited: &mut FxHashSet<CrateId>) -> bool {
121 if visited.contains(&from) { 121 if !visited.insert(from) {
122 return false; 122 return false;
123 } 123 }
124
124 for dep in self.dependencies(from) { 125 for dep in self.dependencies(from) {
125 let crate_id = dep.crate_id(); 126 let crate_id = dep.crate_id();
126 if crate_id == target { 127 if crate_id == target {
@@ -131,7 +132,6 @@ impl CrateGraph {
131 return true; 132 return true;
132 } 133 }
133 } 134 }
134 visited.insert(from);
135 return false; 135 return false;
136 } 136 }
137} 137}