refactor: make local function invisible

This commit is contained in:
Weihang Lo 2023-02-11 00:50:21 +00:00
parent 392db56a08
commit b59e827dba
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -13,6 +13,12 @@ use log::debug;
/// Bacially just normalizes a given path and converts it to a string.
fn render_filename<P: AsRef<Path>>(path: P, basedir: Option<&str>) -> CargoResult<String> {
fn wrap_path(path: &Path) -> CargoResult<String> {
path.to_str()
.ok_or_else(|| internal(format!("path `{:?}` not utf-8", path)))
.map(|f| f.replace(" ", "\\ "))
}
let path = path.as_ref();
if let Some(basedir) = basedir {
let norm_path = normalize_path(path);
@ -26,12 +32,6 @@ fn render_filename<P: AsRef<Path>>(path: P, basedir: Option<&str>) -> CargoResul
}
}
fn wrap_path(path: &Path) -> CargoResult<String> {
path.to_str()
.ok_or_else(|| internal(format!("path `{:?}` not utf-8", path)))
.map(|f| f.replace(" ", "\\ "))
}
/// Collects all dependencies of the `unit` for the output dep info file.
///
/// Dependencies will be stored in `deps`, including: