Skip to content

Commit

Permalink
Rollup merge of rust-lang#81499 - SOF3:patch-1, r=sanxiyn
Browse files Browse the repository at this point in the history
Updated Vec::splice documentation

Replacing with equal number of values does not increase the length of the vec.

Reference: https://stackoverflow.com/a/62559271/3990767
  • Loading branch information
JohnTitor authored Jan 30, 2021
2 parents b43c1d5 + 02094f9 commit 0f11a94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// This is optimal if:
///
/// * The tail (elements in the vector after `range`) is empty,
/// * or `replace_with` yields fewer elements than `range`’s length
/// * or `replace_with` yields fewer or equal elements than `range`’s length
/// * or the lower bound of its `size_hint()` is exact.
///
/// Otherwise, a temporary vector is allocated and the tail is moved twice.
Expand Down

0 comments on commit 0f11a94

Please sign in to comment.