diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 8d38cbd263e..ae10ac088df 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -416,7 +416,7 @@ pub fn graph_to_path_map( println!(" Fetching {}", git.to_string()); fetch_git(fetch_id, &dep.name, git)?; } - find_pkg_dir_within(&repo_path, &dep.name).ok_or_else(|| { + find_dir_within(&repo_path, &dep.name).ok_or_else(|| { anyhow!( "failed to find package `{}` in {}", dep.name, @@ -693,7 +693,7 @@ fn pin_pkg(fetch_id: u64, pkg: &Pkg, path_map: &mut PathMap) -> Result { println!(" Fetching {}", pinned_git.to_string()); fetch_git(fetch_id, &pinned.name, &pinned_git)?; } - let path = find_pkg_dir_within(&repo_path, &pinned.name).ok_or_else(|| { + let path = find_dir_within(&repo_path, &pinned.name).ok_or_else(|| { anyhow!( "failed to find package `{}` in {}", pinned.name, @@ -961,7 +961,7 @@ pub fn build(plan: &BuildPlan, conf: &BuildConfig) -> anyhow::Result<(Compiled, /// Attempt to find a `Forc.toml` with the given project name within the given directory. /// /// Returns the path to the package on success, or `None` in the case it could not be found. -pub fn find_pkg_within(dir: &Path, pkg_name: &str) -> Option { +pub fn find_within(dir: &Path, pkg_name: &str) -> Option { walkdir::WalkDir::new(dir) .into_iter() .filter_map(Result::ok) @@ -977,9 +977,9 @@ pub fn find_pkg_within(dir: &Path, pkg_name: &str) -> Option { }) } -/// The same as `find_pkg_within`, but returns the package's project directory. -pub fn find_pkg_dir_within(dir: &Path, pkg_name: &str) -> Option { - find_pkg_within(dir, pkg_name).and_then(|path| path.parent().map(Path::to_path_buf)) +/// The same as [find_within], but returns the package's project directory. +pub fn find_dir_within(dir: &Path, pkg_name: &str) -> Option { + find_within(dir, pkg_name).and_then(|path| path.parent().map(Path::to_path_buf)) } // TODO: Update this to match behaviour described in the `compile` doc comment above.