@@ -267,6 +267,7 @@ impl<K, V> HashMap<K, V, DefaultHashBuilder> {
267267 /// assert_eq!(map.len(), 0);
268268 /// assert_eq!(map.capacity(), 0);
269269 /// ```
270+ #[ must_use]
270271 #[ cfg_attr( feature = "inline-more" , inline) ]
271272 pub fn new ( ) -> Self {
272273 Self :: default ( )
@@ -296,6 +297,7 @@ impl<K, V> HashMap<K, V, DefaultHashBuilder> {
296297 /// assert_eq!(map.len(), 0);
297298 /// assert!(map.capacity() >= 10);
298299 /// ```
300+ #[ must_use]
299301 #[ cfg_attr( feature = "inline-more" , inline) ]
300302 pub fn with_capacity ( capacity : usize ) -> Self {
301303 Self :: with_capacity_and_hasher ( capacity, DefaultHashBuilder :: default ( ) )
@@ -342,6 +344,7 @@ impl<K, V, A: Allocator> HashMap<K, V, DefaultHashBuilder, A> {
342344 /// // And it also allocates some capacity
343345 /// assert!(map.capacity() > 1);
344346 /// ```
347+ #[ must_use]
345348 #[ cfg_attr( feature = "inline-more" , inline) ]
346349 pub fn new_in ( alloc : A ) -> Self {
347350 Self :: with_hasher_in ( DefaultHashBuilder :: default ( ) , alloc)
@@ -390,6 +393,7 @@ impl<K, V, A: Allocator> HashMap<K, V, DefaultHashBuilder, A> {
390393 /// // But its capacity isn't changed
391394 /// assert_eq!(map.capacity(), empty_map_capacity)
392395 /// ```
396+ #[ must_use]
393397 #[ cfg_attr( feature = "inline-more" , inline) ]
394398 pub fn with_capacity_in ( capacity : usize , alloc : A ) -> Self {
395399 Self :: with_capacity_and_hasher_in ( capacity, DefaultHashBuilder :: default ( ) , alloc)
0 commit comments