Skip to content

Commit 914c4db

Browse files
committed
Auto merge of #29458 - tshepang:better, r=alexcrichton
I see that `extend()` is not called if new_len > len()
2 parents 2e07996 + d7a5aba commit 914c4db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcollections/vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,9 @@ impl<T> Vec<T> {
859859
impl<T: Clone> Vec<T> {
860860
/// Resizes the `Vec` in-place so that `len()` is equal to `new_len`.
861861
///
862-
/// Calls either `extend()` or `truncate()` depending on whether `new_len`
863-
/// is larger than the current value of `len()` or not.
862+
/// If `new_len` is greater than `len()`, the `Vec` is extended by the
863+
/// difference, with each additional slot filled with `value`.
864+
/// If `new_len` is less than `len()`, the `Vec` is simply truncated.
864865
///
865866
/// # Examples
866867
///

0 commit comments

Comments
 (0)