diff options
| author | r00ster91 <r00ster91@protonmail.com> | 2021-11-01 18:52:26 +0100 |
|---|---|---|
| committer | r00ster91 <r00ster91@protonmail.com> | 2021-11-01 18:52:26 +0100 |
| commit | 5f6cfd211a82313ad1d638f7f2a68a3a70a7d97b (patch) | |
| tree | 0445bdcfe25bf8289af175dd3e181d2360bdc78b /library/alloc/src | |
| parent | e9b0d992598d9a51fd7b1a4ae8f9cbafac5e593b (diff) | |
| download | rust-5f6cfd211a82313ad1d638f7f2a68a3a70a7d97b.tar.gz rust-5f6cfd211a82313ad1d638f7f2a68a3a70a7d97b.zip | |
mention `remove` in `swap_remove`
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index d52c78eedf3..a72769f7807 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1272,6 +1272,9 @@ impl<T, A: Allocator> Vec<T, A> { /// The removed element is replaced by the last element of the vector. /// /// This does not preserve ordering, but is *O*(1). + /// If you need to preserve the element order, use [`remove`] instead. + /// + /// [`remove`]: Vec::remove /// /// # Panics /// @@ -1368,7 +1371,7 @@ impl<T, A: Allocator> Vec<T, A> { /// shifting all elements after it to the left. /// /// Note: Because this shifts over the remaining elements, it has a - /// worst-case performance of O(n). If you don't need the order of elements + /// worst-case performance of *O*(*n*). If you don't need the order of elements /// to be preserved, use [`swap_remove`] instead. /// /// [`swap_remove`]: Vec::swap_remove |
