diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-11-04 16:49:32 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-11-05 10:50:25 -0700 |
| commit | 727f1d3f1647553deab09f22746b7e482358e5f6 (patch) | |
| tree | a49911324265afb5bdb6757e9f6fc171e8648414 /src | |
| parent | 0670d4b7f33d2b66a6de069901ab47768180e402 (diff) | |
| parent | 3e4bd8843829284a62af22687ee415a66c8207cc (diff) | |
Rollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton
Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From Fixes #37561. First contribution, happy with any and all feedback!
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcollections/string.rs | 8 | ||||
| -rw-r--r-- | src/libstd/path.rs | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 286f06b6fe3..348eb6fb5ff 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1904,10 +1904,10 @@ impl<'a> FromIterator<String> for 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() } } diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 9b7f9980cc0..bb6883236e8 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1173,6 +1173,13 @@ impl From<OsString> for 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 { @@ -1283,13 +1290,6 @@ impl AsRef<OsStr> for PathBuf { } } -#[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 |
