Skip to content

Commit 197c20b

Browse files
authored
Rollup merge of rust-lang#37585 - leodasvacas:change_into_to_from, r=alexcrichton
Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From Fixes rust-lang#37561. First contribution, happy with any and all feedback!
2 parents e534882 + 3e4bd88 commit 197c20b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/libcollections/string.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1904,10 +1904,10 @@ impl<'a> FromIterator<String> for Cow<'a, str> {
19041904
}
19051905
}
19061906

1907-
#[stable(feature = "rust1", since = "1.0.0")]
1908-
impl Into<Vec<u8>> for String {
1909-
fn into(self) -> Vec<u8> {
1910-
self.into_bytes()
1907+
#[stable(feature = "from_string_for_vec_u8", since = "1.14.0")]
1908+
impl From<String> for Vec<u8> {
1909+
fn from(string : String) -> Vec<u8> {
1910+
string.into_bytes()
19111911
}
19121912
}
19131913

src/libstd/path.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,13 @@ impl From<OsString> for PathBuf {
11731173
}
11741174
}
11751175

1176+
#[stable(feature = "from_path_buf_for_os_string", since = "1.14.0")]
1177+
impl From<PathBuf> for OsString {
1178+
fn from(path_buf : PathBuf) -> OsString {
1179+
path_buf.inner
1180+
}
1181+
}
1182+
11761183
#[stable(feature = "rust1", since = "1.0.0")]
11771184
impl From<String> for PathBuf {
11781185
fn from(s: String) -> PathBuf {
@@ -1283,13 +1290,6 @@ impl AsRef<OsStr> for PathBuf {
12831290
}
12841291
}
12851292

1286-
#[stable(feature = "rust1", since = "1.0.0")]
1287-
impl Into<OsString> for PathBuf {
1288-
fn into(self) -> OsString {
1289-
self.inner
1290-
}
1291-
}
1292-
12931293
/// A slice of a path (akin to [`str`]).
12941294
///
12951295
/// This type supports a number of operations for inspecting a path, including

0 commit comments

Comments
 (0)