mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-24 12:03:31 +00:00
rename to dfs_find
This commit is contained in:
parent
792dabc0a6
commit
77eaa208ed
1 changed files with 3 additions and 3 deletions
|
@ -94,7 +94,7 @@ impl CrateGraph {
|
|||
crate_id
|
||||
}
|
||||
pub fn add_dep(&mut self, from: CrateId, name: SmolStr, to: CrateId) {
|
||||
if self.dfs(from, to) {
|
||||
if self.dfs_find(from, to) {
|
||||
panic!("Cycle dependencies found.")
|
||||
}
|
||||
self.arena.get_mut(&from).unwrap().add_dep(name, to)
|
||||
|
@ -115,14 +115,14 @@ impl CrateGraph {
|
|||
) -> impl Iterator<Item=&'a Dependency> + 'a {
|
||||
self.arena[&crate_id].dependencies.iter()
|
||||
}
|
||||
fn dfs(&self, target: CrateId, from: CrateId) -> bool {
|
||||
fn dfs_find(&self, target: CrateId, from: CrateId) -> bool {
|
||||
for dep in self.dependencies(from) {
|
||||
let crate_id = dep.crate_id();
|
||||
if crate_id == target {
|
||||
return true;
|
||||
}
|
||||
if self.arena.contains_key(&crate_id) {
|
||||
if self.dfs(target, crate_id) {
|
||||
if self.dfs_find(target, crate_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue