Skip to content

Commit

Permalink
Rewrite slice::chunks doc example to not require printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Jul 31, 2016
1 parent 1225e12 commit 2eea1f3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,13 @@ impl<T> [T] {
///
/// # Example
///
/// Print the slice two elements at a time (i.e. `[1,2]`,
/// `[3,4]`, `[5]`):
///
/// ```rust
/// let v = &[1, 2, 3, 4, 5];
///
/// for chunk in v.chunks(2) {
/// println!("{:?}", chunk);
/// }
/// ```
/// let slice = ['l', 'o', 'r', 'e', 'm'];
/// let mut iter = slice.chunks(2);
/// assert_eq!(iter.next().unwrap(), &['l', 'o']);
/// assert_eq!(iter.next().unwrap(), &['r', 'e']);
/// assert_eq!(iter.next().unwrap(), &['m']);
/// assert!(iter.next().is_none());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
Expand Down

0 comments on commit 2eea1f3

Please sign in to comment.