diff --git a/crates/nu-path/src/path.rs b/crates/nu-path/src/path.rs index eea2e88f9f..06ee707c7c 100644 --- a/crates/nu-path/src/path.rs +++ b/crates/nu-path/src/path.rs @@ -75,6 +75,16 @@ impl Path
{ self.inner.file_name() } + #[inline] + pub fn strip_prefix( + &self, + base: impl AsRef>, + ) -> Result<&RelativePath, StripPrefixError> { + self.inner + .strip_prefix(&base.as_ref().inner) + .map(RelativePath::new_unchecked) + } + #[inline] pub fn starts_with(&self, base: impl AsRef>) -> bool { self.inner.starts_with(&base.as_ref().inner) @@ -162,16 +172,6 @@ impl Path { .then_some(RelativePath::new_unchecked(&self.inner)) .ok_or(AbsolutePath::new_unchecked(&self.inner)) } - - #[inline] - pub fn strip_prefix( - &self, - base: impl AsRef>, - ) -> Result<&RelativePath, StripPrefixError> { - self.inner - .strip_prefix(&base.as_ref().inner) - .map(RelativePath::new_unchecked) - } } impl Path {