提交 727f1d3f 编写于 作者: A Alex Crichton

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!
......@@ -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()
}
}
......
......@@ -1173,6 +1173,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 {
......@@ -1283,13 +1290,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册