diff options
-rw-r--r-- | crates/ra_db/src/input.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index f220eda9e..f6d11844a 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -94,7 +94,7 @@ impl CrateGraph { | |||
94 | crate_id | 94 | crate_id |
95 | } | 95 | } |
96 | pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) { | 96 | pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) { |
97 | if self.dfs(from, to) { | 97 | if self.dfs_find(from, to) { |
98 | panic!("Cycle dependencies found.") | 98 | panic!("Cycle dependencies found.") |
99 | } | 99 | } |
100 | self.arena.get_mut(&from).unwrap().add_dep(name, to) | 100 | self.arena.get_mut(&from).unwrap().add_dep(name, to) |
@@ -115,14 +115,14 @@ impl CrateGraph { | |||
115 | ) -> impl Iterator<Item=&'a Dependency> + 'a { | 115 | ) -> impl Iterator<Item=&'a Dependency> + 'a { |
116 | self.arena[&crate_id].dependencies.iter() | 116 | self.arena[&crate_id].dependencies.iter() |
117 | } | 117 | } |
118 | fn dfs(&self, target: CrateId, from: CrateId) -> bool { | 118 | fn dfs_find(&self, target: CrateId, from: CrateId) -> bool { |
119 | for dep in self.dependencies(from) { | 119 | for dep in self.dependencies(from) { |
120 | let crate_id = dep.crate_id(); | 120 | let crate_id = dep.crate_id(); |
121 | if crate_id == target { | 121 | if crate_id == target { |
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | if self.arena.contains_key(&crate_id) { | 124 | if self.arena.contains_key(&crate_id) { |
125 | if self.dfs(target, crate_id) { | 125 | if self.dfs_find(target, crate_id) { |
126 | return true; | 126 | return true; |
127 | } | 127 | } |
128 | } | 128 | } |