We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe6847a commit a446b68Copy full SHA for a446b68
src/libcollections/vec.rs
@@ -636,7 +636,9 @@ impl<T> Vec<T> {
636
}
637
638
639
- /// Shrinks the capacity of the vector as much as possible.
+ /// Shrinks the capacity of the vector as much as possible. It will drop
640
+ /// down as close as possible to the length but the allocator may still
641
+ /// inform the vector that there is space for a few more elements.
642
///
643
/// # Example
644
@@ -645,7 +647,7 @@ impl<T> Vec<T> {
645
647
/// vec.push_all([1, 2, 3]);
646
648
/// assert_eq!(vec.capacity(), 10);
649
/// vec.shrink_to_fit();
- /// assert_eq!(vec.capacity(), 3);
650
+ /// assert!(vec.capacity() >= 3);
651
/// ```
652
#[stable]
653
pub fn shrink_to_fit(&mut self) {
0 commit comments