about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorAndy Kurnia <andykurn@gmail.com>2024-03-23 21:38:32 +0800
committerAndy Kurnia <andykurn@gmail.com>2024-03-23 21:38:32 +0800
commit5afe4a9e09b09b2a74cf5cbce5b69ca40b3873a9 (patch)
tree3c03dc406ee262ef8d71b61390bbf04376e7b63f /library/alloc/src
parentc3b05c6e5b5b59613350b8c2875b0add67ed74df (diff)
downloadrust-5afe4a9e09b09b2a74cf5cbce5b69ca40b3873a9.tar.gz
rust-5afe4a9e09b09b2a74cf5cbce5b69ca40b3873a9.zip
improve example on inserting to a sorted vector to avoid shifting equal elements
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/collections/vec_deque/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs
index 41adc2e79dc..41935a69420 100644
--- a/library/alloc/src/collections/vec_deque/mod.rs
+++ b/library/alloc/src/collections/vec_deque/mod.rs
@@ -2464,7 +2464,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
     ///
     /// let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
     /// let num = 42;
-    /// let idx = deque.partition_point(|&x| x < num);
+    /// let idx = deque.partition_point(|&x| x <= num);
     /// // The above is equivalent to `let idx = deque.binary_search(&num).unwrap_or_else(|x| x);`
     /// deque.insert(idx, num);
     /// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);