]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/src/vec/mod.rs
Add #[must_use] to alloc constructors
[rust.git] / library / alloc / src / vec / mod.rs
index 4f18a054a0d9899313b610b9755b3566750620b9..a12acb1a1c07f7da512844658aa3992f18418209 100644 (file)
@@ -420,6 +420,7 @@ impl<T> Vec<T> {
     #[inline]
     #[rustc_const_stable(feature = "const_vec_new", since = "1.39.0")]
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[must_use]
     pub const fn new() -> Self {
         Vec { buf: RawVec::NEW, len: 0 }
     }
@@ -464,6 +465,7 @@ pub const fn new() -> Self {
     #[cfg(not(no_global_oom_handling))]
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[must_use]
     pub fn with_capacity(capacity: usize) -> Self {
         Self::with_capacity_in(capacity, Global)
     }