Skip to content

Commit 596b0c8

Browse files
committed
Add assert to Vec with_capacity docs
1 parent eeaf497 commit 596b0c8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/liballoc/vec.rs

+2
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,11 @@ impl<T> Vec<T> {
348348
/// for i in 0..10 {
349349
/// vec.push(i);
350350
/// }
351+
/// assert_eq!(vec.capacity(), 10);
351352
///
352353
/// // ...but this may make the vector reallocate
353354
/// vec.push(11);
355+
/// assert!(vec.capacity() >= 11);
354356
/// ```
355357
#[inline]
356358
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)