about summary refs log tree commit diff
path: root/library/alloc/src/vec/mod.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-11-19 02:22:56 +0900
committerGitHub <noreply@github.com>2021-11-19 02:22:56 +0900
commit3e97d9bd972e138b0aaf8fc697cdb8d181f43a1a (patch)
treefb52dc2c0a8c2858c1ed7c940081a0a40c8b0fdb /library/alloc/src/vec/mod.rs
parent153e4dc38ac120ca9630050e2109cc636d2a2d28 (diff)
parent5f6cfd211a82313ad1d638f7f2a68a3a70a7d97b (diff)
downloadrust-3e97d9bd972e138b0aaf8fc697cdb8d181f43a1a.tar.gz
rust-3e97d9bd972e138b0aaf8fc697cdb8d181f43a1a.zip
Rollup merge of #90480 - r00ster91:remove, r=kennytm
Mention `Vec::remove` in `Vec::swap_remove`'s docs

Thought this was a nice addition.
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
-rw-r--r--library/alloc/src/vec/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 4989244b50e..85759917765 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