about summary refs log tree commit diff
path: root/src/libstd/path
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-12-02 00:33:04 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2013-12-04 22:35:53 +1100
commitb0426edc0a83699de79ceffcbe603812b9b53374 (patch)
tree1aff5ef5a386dbe93febb8eab89033fa83f33a8a /src/libstd/path
parent9d64e46013096997627da62ecc65225bc22682e8 (diff)
downloadrust-b0426edc0a83699de79ceffcbe603812b9b53374.tar.gz
rust-b0426edc0a83699de79ceffcbe603812b9b53374.zip
std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.
Diffstat (limited to 'src/libstd/path')
-rw-r--r--src/libstd/path/mod.rs14
-rw-r--r--src/libstd/path/posix.rs6
2 files changed, 10 insertions, 10 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
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index b2bc00dd247..ddf2cce21b0 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -396,13 +396,13 @@ impl Path {
     /// Returns an iterator that yields each component of the path as Option<&str>.
     /// See components() for details.
     pub fn str_components<'a>(&'a self) -> StrComponentIter<'a> {
-        self.components().map(str::from_utf8_slice_opt)
+        self.components().map(str::from_utf8_opt)
     }
 
     /// Returns an iterator that yields each component of the path in reverse as Option<&str>.
     /// See components() for details.
     pub fn rev_str_components<'a>(&'a self) -> RevStrComponentIter<'a> {
-        self.rev_components().map(str::from_utf8_slice_opt)
+        self.rev_components().map(str::from_utf8_opt)
     }
 }
 
@@ -684,7 +684,7 @@ mod tests {
             (s: $path:expr, $op:ident, $exp:expr, opt) => (
                 {
                     let path = Path::init($path);
-                    let left = path.$op().map(|x| str::from_utf8_slice(x));
+                    let left = path.$op().map(|x| str::from_utf8(x));
                     assert_eq!(left, $exp);
                 }
             );