]> git.lizzy.rs Git - rust.git/commitdiff
Change Into<Vec<u8>> for String and Into<OsString> for PathBuf to From impls
authorleonardo.yvens <leoyvens@gmail.com>
Fri, 4 Nov 2016 17:54:08 +0000 (15:54 -0200)
committerleonardo.yvens <leoyvens@gmail.com>
Fri, 4 Nov 2016 17:54:08 +0000 (15:54 -0200)
src/libcollections/string.rs
src/libstd/path.rs

index 286f06b6fe32ac23c4a88ea2fe036279b2d7e631..348eb6fb5ffa4806c5ff7b1fcfcefd9db5166735 100644 (file)
@@ -1904,10 +1904,10 @@ fn from_iter<I: IntoIterator<Item = String>>(it: I) -> Cow<'a, str> {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
-impl Into<Vec<u8>> for String {
-    fn into(self) -> Vec<u8> {
-        self.into_bytes()
+#[stable(feature = "from_string_for_vec_u8", since = "1.14.0")]
+impl From<String> for Vec<u8> {
+    fn from(string : String) -> Vec<u8> {
+        string.into_bytes()
     }
 }
 
index d6a5dfe5518003bf14630d28cbbf08a7cc21a2b6..e8a7951d557b29af39d72b6c4b8d2a6cf5ba707a 100644 (file)
@@ -1172,6 +1172,13 @@ fn from(s: OsString) -> PathBuf {
     }
 }
 
+#[stable(feature = "from_path_buf_for_os_string", since = "1.14.0")]
+impl From<PathBuf> for OsString {
+    fn from(path_buf : PathBuf) -> OsString {
+        path_buf.inner
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl From<String> for PathBuf {
     fn from(s: String) -> PathBuf {
@@ -1282,13 +1289,6 @@ fn as_ref(&self) -> &OsStr {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
-impl Into<OsString> for PathBuf {
-    fn into(self) -> OsString {
-        self.inner
-    }
-}
-
 /// A slice of a path (akin to [`str`]).
 ///
 /// This type supports a number of operations for inspecting a path, including