From fb2d0f5c03d2f699eb87bc1986386bdcf6a3f6eb Mon Sep 17 00:00:00 2001 From: John Kugelman Date: Thu, 14 Oct 2021 19:56:53 -0400 Subject: Add #[must_use] to remaining alloc functions --- library/alloc/src/string.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'library/alloc/src/string.rs') diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index f479bf231b3..14ebc4dfe8b 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -898,6 +898,7 @@ impl String { /// assert!(s.capacity() >= 10); /// ``` #[inline] + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub fn capacity(&self) -> usize { self.vec.capacity() @@ -1822,6 +1823,7 @@ impl FromUtf8Error { /// // the first byte is invalid here /// assert_eq!(1, error.valid_up_to()); /// ``` + #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub fn utf8_error(&self) -> Utf8Error { self.error -- cgit 1.4.1-3-g733a5