Skip to content

Commit

Permalink
Update example code for Vec::splice to change the length
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Dec 18, 2021
1 parent d3f3004 commit 574bc67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 574bc67

Please sign in to comment.