From a0b421928c220555c6387054bf75c51ca1efec85 Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Wed, 25 Sep 2024 21:09:41 +0300 Subject: [PATCH] Implemented TryFrom instead of TryInto --- library/alloc/src/ffi/c_str.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 9b2187c71e212..15b0506023d0b 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -827,15 +827,15 @@ impl FromStr for CString { } } -impl TryInto for CString { +impl TryFrom for String { type Error = IntoStringError; - /// Converts the `CString` into a [`String`] if it contains valid UTF-8 data. + /// Converts a [`CString`] into a [`String`] if it contains valid UTF-8 data. /// /// This method is equivalent to [`CString::into_string`]. #[inline] - fn try_into(self) -> Result { - self.into_string() + fn try_from(value: CString) -> Result { + value.into_string() } }