diff options
Diffstat (limited to 'src/libstd/path/mod.rs')
| -rw-r--r-- | src/libstd/path/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 8ecfdb3a9e0..79989b838f6 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -176,7 +176,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// If the path is not representable in utf-8, this returns None. #[inline] fn as_str<'a>(&'a self) -> Option<&'a str> { - str::from_utf8_slice_opt(self.as_vec()) + str::from_utf8_opt(self.as_vec()) } /// Returns the path as a byte vector @@ -207,7 +207,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// See `dirname` for details. #[inline] fn dirname_str<'a>(&'a self) -> Option<&'a str> { - str::from_utf8_slice_opt(self.dirname()) + str::from_utf8_opt(self.dirname()) } /// Returns the file component of `self`, as a byte vector. /// If `self` represents the root of the file hierarchy, returns None. @@ -217,7 +217,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// See `filename` for details. #[inline] fn filename_str<'a>(&'a self) -> Option<&'a str> { - self.filename().and_then(str::from_utf8_slice_opt) + self.filename().and_then(str::from_utf8_opt) } /// Returns the stem of the filename of `self`, as a byte vector. /// The stem is the portion of the filename just before the last '.'. @@ -239,7 +239,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// See `filestem` for details. #[inline] fn filestem_str<'a>(&'a self) -> Option<&'a str> { - self.filestem().and_then(str::from_utf8_slice_opt) + self.filestem().and_then(str::from_utf8_opt) } /// Returns the extension of the filename of `self`, as an optional byte vector. /// The extension is the portion of the filename just after the last '.'. @@ -262,7 +262,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// See `extension` for details. #[inline] fn extension_str<'a>(&'a self) -> Option<&'a str> { - self.extension().and_then(str::from_utf8_slice_opt) + self.extension().and_then(str::from_utf8_opt) } /// Replaces the filename portion of the path with the given byte vector or string. @@ -493,12 +493,12 @@ pub trait BytesContainer { /// Raises `str::null_byte` if not utf-8 #[inline] fn container_as_str<'a>(&'a self) -> &'a str { - str::from_utf8_slice(self.container_as_bytes()) + str::from_utf8(self.container_as_bytes()) } /// Returns the receiver interpreted as a utf-8 string, if possible #[inline] fn container_as_str_opt<'a>(&'a self) -> Option<&'a str> { - str::from_utf8_slice_opt(self.container_as_bytes()) + str::from_utf8_opt(self.container_as_bytes()) } /// Returns whether .container_as_str() is guaranteed to not fail // FIXME (#8888): Remove unused arg once ::<for T> works |
