diff options
author | gfreezy <[email protected]> | 2018-12-21 14:30:41 +0000 |
---|---|---|
committer | gfreezy <[email protected]> | 2018-12-21 14:30:41 +0000 |
commit | 77eaa208ed2f423572fbeb8096f8c180d22c78fd (patch) | |
tree | aa9f310ea5f87668f048b0568be46ef83b48c906 /crates/ra_db/src | |
parent | 792dabc0a6a198d0fdeb6449b457a4e61009178e (diff) |
rename to dfs_find
Diffstat (limited to 'crates/ra_db/src')
-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 | } |