From 42dae9d96d2de5e18192ec13fd00380dcaef1745 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 24 Jul 2017 23:24:42 +0200 Subject: [PATCH] doc: make into_iter example more concise --- src/libcore/iter/traits.rs | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index 679cf3a9b23..06ede4f3f76 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -147,22 +147,13 @@ pub trait FromIterator: Sized { /// /// ``` /// let v = vec![1, 2, 3]; -/// /// let mut iter = v.into_iter(); /// -/// let n = iter.next(); -/// assert_eq!(Some(1), n); -/// -/// let n = iter.next(); -/// assert_eq!(Some(2), n); -/// -/// let n = iter.next(); -/// assert_eq!(Some(3), n); -/// -/// let n = iter.next(); -/// assert_eq!(None, n); +/// assert_eq!(Some(1), iter.next()); +/// assert_eq!(Some(2), iter.next()); +/// assert_eq!(Some(3), iter.next()); +/// assert_eq!(None, iter.next()); /// ``` -/// /// Implementing `IntoIterator` for your type: /// /// ``` @@ -227,20 +218,12 @@ pub trait IntoIterator { /// /// ``` /// let v = vec![1, 2, 3]; - /// /// let mut iter = v.into_iter(); /// - /// let n = iter.next(); - /// assert_eq!(Some(1), n); - /// - /// let n = iter.next(); - /// assert_eq!(Some(2), n); - /// - /// let n = iter.next(); - /// assert_eq!(Some(3), n); - /// - /// let n = iter.next(); - /// assert_eq!(None, n); + /// assert_eq!(Some(1), iter.next()); + /// assert_eq!(Some(2), iter.next()); + /// assert_eq!(Some(3), iter.next()); + /// assert_eq!(None, iter.next()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn into_iter(self) -> Self::IntoIter;