Skip to content

Commit 4cdbb8c

Browse files
committed
reword guarantee section to leave wiggle room for non-(de)allocating shrinks
1 parent 84637e6 commit 4cdbb8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/alloc/src/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ use crate::raw_vec::RawVec;
243243
/// * It would penalize the general case, incurring an additional branch
244244
/// on every access.
245245
///
246-
/// `Vec` will never automatically shrink itself, even if completely empty. This
247-
/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
246+
/// `Vec` will not automatically shrink itself, even if completely empty, when doing so
247+
/// would cause unnecessary allocations or deallocations to occur. Emptying a `Vec`
248248
/// and then filling it back up to the same [`len`] should incur no calls to
249249
/// the allocator. If you wish to free up unused memory, use
250250
/// [`shrink_to_fit`].

0 commit comments

Comments
 (0)