Skip to content

Commit a0b4219

Browse files
committed
Implemented TryFrom instead of TryInto
1 parent 3243cd9 commit a0b4219

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/alloc/src/ffi/c_str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,15 +827,15 @@ impl FromStr for CString {
827827
}
828828
}
829829

830-
impl TryInto<String> for CString {
830+
impl TryFrom<CString> for String {
831831
type Error = IntoStringError;
832832

833-
/// Converts the `CString` into a [`String`] if it contains valid UTF-8 data.
833+
/// Converts a [`CString`] into a [`String`] if it contains valid UTF-8 data.
834834
///
835835
/// This method is equivalent to [`CString::into_string`].
836836
#[inline]
837-
fn try_into(self) -> Result<String, Self::Error> {
838-
self.into_string()
837+
fn try_from(value: CString) -> Result<Self, Self::Error> {
838+
value.into_string()
839839
}
840840
}
841841

0 commit comments

Comments
 (0)