about summary refs log tree commit diff
diff options
context:
space:
mode:
authorajtribick <ajtribick@googlemail.com>2021-12-18 15:59:33 +0100
committerAndrew Tribick <ajtribick@googlemail.com>2021-12-18 16:10:00 +0100
commit574bc67736114d47f6ed38bc273dff9f9dd38473 (patch)
tree2ccfa68b669d82f994b4560ff38cb21ea2e9288e
parentd3f300477b89e70dd42379ba53c0e8ff74e9c694 (diff)
downloadrust-574bc67736114d47f6ed38bc273dff9f9dd38473.tar.gz
rust-574bc67736114d47f6ed38bc273dff9f9dd38473.zip
Update example code for Vec::splice to change the length
-rw-r--r--library/alloc/src/vec/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index d24b4bdffde..7185f3de18a 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -2683,11 +2683,11 @@ impl<T, A: Allocator> Vec<T, A> {
     /// # Examples
     ///
     /// ```
-    /// let mut v = vec![1, 2, 3];
-    /// let new = [7, 8];
-    /// let u: Vec<_> = v.splice(..2, new).collect();
-    /// assert_eq!(v, &[7, 8, 3]);
-    /// assert_eq!(u, &[1, 2]);
+    /// let mut v = vec![1, 2, 3, 4];
+    /// let new = [7, 8, 9];
+    /// let u: Vec<_> = v.splice(1..3, new).collect();
+    /// assert_eq!(v, &[1, 7, 8, 9, 4]);
+    /// assert_eq!(u, &[2, 3]);
     /// ```
     #[cfg(not(no_global_oom_handling))]
     #[inline]