From d23b9b471d2f81fb5687ddc3cefebcfff9c6267e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 15 May 2018 10:10:05 +0200 Subject: [PATCH] mark std::string::String::new() and std::vec::Vec::new() as #[must_use]. --- src/liballoc/string.rs | 1 + src/liballoc/vec.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index da9afdd2ca37b..663e1ac915dbf 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -378,6 +378,7 @@ impl String { /// ``` /// let s = String::new(); /// ``` + #[must_use = "newly created String must be used"] #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_string_new")] diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 690cbcb559bbf..312aad361041e 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -320,6 +320,7 @@ impl Vec { /// # #![allow(unused_mut)] /// let mut vec: Vec = Vec::new(); /// ``` + #[must_use = "newly created vector must be used"] #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_vec_new")]