Skip to content

Commit 38f2cfa

Browse files
authored
Rollup merge of rust-lang#90480 - r00ster91:remove, r=kennytm
Mention `Vec::remove` in `Vec::swap_remove`'s docs Thought this was a nice addition.
2 parents a4739f2 + 5f6cfd2 commit 38f2cfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/alloc/src/vec/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,9 @@ impl<T, A: Allocator> Vec<T, A> {
12721272
/// The removed element is replaced by the last element of the vector.
12731273
///
12741274
/// This does not preserve ordering, but is *O*(1).
1275+
/// If you need to preserve the element order, use [`remove`] instead.
1276+
///
1277+
/// [`remove`]: Vec::remove
12751278
///
12761279
/// # Panics
12771280
///
@@ -1368,7 +1371,7 @@ impl<T, A: Allocator> Vec<T, A> {
13681371
/// shifting all elements after it to the left.
13691372
///
13701373
/// Note: Because this shifts over the remaining elements, it has a
1371-
/// worst-case performance of O(n). If you don't need the order of elements
1374+
/// worst-case performance of *O*(*n*). If you don't need the order of elements
13721375
/// to be preserved, use [`swap_remove`] instead.
13731376
///
13741377
/// [`swap_remove`]: Vec::swap_remove

0 commit comments

Comments
 (0)