From cf2bcd10ed28b169b8df74383c2a35a4ffbdcf40 Mon Sep 17 00:00:00 2001 From: John Kugelman Date: Sun, 10 Oct 2021 18:22:40 -0400 Subject: Add #[must_use] to from_value conversions --- library/alloc/src/str.rs | 1 + library/alloc/src/string.rs | 1 + 2 files changed, 2 insertions(+) (limited to 'library/alloc/src') diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs index 2900d01d9bd..ac7f2304456 100644 --- a/library/alloc/src/str.rs +++ b/library/alloc/src/str.rs @@ -595,6 +595,7 @@ impl str { /// assert_eq!("☺", &*smile); /// ``` #[stable(feature = "str_box_extras", since = "1.20.0")] +#[must_use] #[inline] pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box { unsafe { Box::from_raw(Box::into_raw(v) as *mut str) } diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index d88b8e39898..0c383b8bdb6 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -761,6 +761,7 @@ impl String { /// assert_eq!("💖", sparkle_heart); /// ``` #[inline] + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_utf8_unchecked(bytes: Vec) -> String { String { vec: bytes } -- cgit 1.4.1-3-g733a5