]> git.lizzy.rs Git - rust.git/commitdiff
Show that the capacity changed in HashSet::reserve doc example.
authorCorey Farwell <coreyf@rwell.org>
Tue, 1 Aug 2017 11:42:59 +0000 (07:42 -0400)
committerCorey Farwell <coreyf@rwell.org>
Tue, 1 Aug 2017 23:51:00 +0000 (19:51 -0400)
src/libstd/collections/hash/set.rs

index 040595bbb0426b364c4aadd1a9369b2073674c88..0e65a30f3b2a3554c47629fa0dcffd53ef218516 100644 (file)
@@ -260,6 +260,7 @@ pub fn capacity(&self) -> usize {
     /// use std::collections::HashSet;
     /// let mut set: HashSet<i32> = HashSet::new();
     /// set.reserve(10);
+    /// assert!(set.capacity() >= 10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn reserve(&mut self, additional: usize) {