summaryrefslogtreecommitdiffstats
path: root/vendor/gix-path/src/realpath.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix-path/src/realpath.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-path/src/realpath.rs')
-rw-r--r--vendor/gix-path/src/realpath.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/vendor/gix-path/src/realpath.rs b/vendor/gix-path/src/realpath.rs
index 8b88eb15e..2969bd4d7 100644
--- a/vendor/gix-path/src/realpath.rs
+++ b/vendor/gix-path/src/realpath.rs
@@ -31,19 +31,18 @@ pub(crate) mod function {
///
/// If `path` is relative, the current working directory be used to make it absolute.
pub fn realpath(path: impl AsRef<Path>) -> Result<PathBuf, Error> {
+ let path = path.as_ref();
let cwd = path
- .as_ref()
.is_relative()
.then(std::env::current_dir)
.unwrap_or_else(|| Ok(PathBuf::default()))
.map_err(Error::CurrentWorkingDir)?;
- realpath_opts(path, cwd, MAX_SYMLINKS)
+ realpath_opts(path, &cwd, MAX_SYMLINKS)
}
/// The same as [`realpath()`], but allow to configure `max_symlinks` to configure how many symbolic links we are going to follow.
/// This serves to avoid running into cycles or doing unreasonable amounts of work.
- pub fn realpath_opts(path: impl AsRef<Path>, cwd: impl AsRef<Path>, max_symlinks: u8) -> Result<PathBuf, Error> {
- let path = path.as_ref();
+ pub fn realpath_opts(path: &Path, cwd: &Path, max_symlinks: u8) -> Result<PathBuf, Error> {
if path.as_os_str().is_empty() {
return Err(Error::EmptyPath);
}