Skip to content

Commit

Permalink
Clean up the example on slice::IterMut::as_slice()
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Mar 6, 2019
1 parent 5384a11 commit 51e0d1c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3300,20 +3300,16 @@ impl<'a, T> IterMut<'a, T> {
///
/// ```
/// # #![feature(slice_iter_mut_as_slice)]
/// // First, we declare a type which has `iter_mut` method to get the `IterMut`
/// // struct (&[usize here]):
/// let mut slice: &mut [usize] = &mut [1, 2, 3];
///
/// // Then, we get the iterator:
/// // First, we get the iterator:
/// let mut iter = slice.iter_mut();
/// // So if we print what the `as_slice` method returns here, we have "[1, 2, 3]":
/// println!("{:?}", iter.as_slice());
/// // So if we check what the `as_slice` method returns here, we have "[1, 2, 3]":
/// assert_eq!(iter.as_slice(), &[1, 2, 3]);
///
/// // Next, we move to the second element of the slice:
/// iter.next();
/// // Now `as_slice` returns "[2, 3]":
/// println!("{:?}", iter.as_slice());
/// assert_eq!(iter.as_slice(), &[2, 3]);
/// ```
#[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "0")]
Expand Down

0 comments on commit 51e0d1c

Please sign in to comment.