]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/src/string.rs
Rollup merge of #89835 - jkugelman:must-use-expensive-computations, r=joshtriplett
[rust.git] / library / alloc / src / string.rs
index d2471f164fc4a80eb684f955b7e2f228b7d46f58..677942a1820c94e23588dff87bf526e236d82099 100644 (file)
@@ -552,6 +552,7 @@ pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
     ///
     /// assert_eq!("Hello �World", output);
     /// ```
+    #[must_use]
     #[cfg(not(no_global_oom_handling))]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str> {
@@ -646,6 +647,7 @@ pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
     ///            String::from_utf16_lossy(v));
     /// ```
     #[cfg(not(no_global_oom_handling))]
+    #[must_use]
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn from_utf16_lossy(v: &[u16]) -> String {