diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-05 19:07:07 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-05 19:07:07 -0800 |
| commit | f331c568698db2361598a7ae017bfdb1fed9543d (patch) | |
| tree | 5d7ffae7c8d94942db63cf1db63cdbafcdd40e06 /src | |
| parent | 7975fd9cee750f26f9f6ef85b92a20b24ee24120 (diff) | |
| download | rust-f331c568698db2361598a7ae017bfdb1fed9543d.tar.gz rust-f331c568698db2361598a7ae017bfdb1fed9543d.zip | |
Test fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/iter.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b262054992c..79c268c8441 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -580,44 +580,6 @@ pub trait IteratorExt: Iterator + Sized { (left, right) } - /// Loops through `n` iterations, returning the `n`th element of the - /// iterator. - /// - /// # Example - /// - /// ```rust - /// let a = [1, 2, 3, 4, 5]; - /// let mut it = a.iter(); - /// assert!(it.nth(2).unwrap() == &3); - /// assert!(it.nth(2) == None); - /// ``` - #[inline] - #[stable] - fn nth(&mut self, mut n: uint) -> Option< <Self as Iterator>::Item> { - for x in *self { - if n == 0 { return Some(x) } - n -= 1; - } - None - } - - /// Loops through the entire iterator, returning the last element of the - /// iterator. - /// - /// # Example - /// - /// ```rust - /// let a = [1, 2, 3, 4, 5]; - /// assert!(a.iter().last().unwrap() == &5); - /// ``` - #[inline] - #[unstable = "just changed to take self by value"] - fn last(mut self) -> Option< <Self as Iterator>::Item> { - let mut last = None; - for x in self { last = Some(x); } - last - } - /// Performs a fold operation over the entire iterator, returning the /// eventual state at the end of the iteration. /// @@ -639,21 +601,6 @@ pub trait IteratorExt: Iterator + Sized { accum } - /// Counts the number of elements in this iterator. - /// - /// # Example - /// - /// ```rust - /// let a = [1, 2, 3, 4, 5]; - /// let mut it = a.iter(); - /// assert!(it.count() == 5); - /// ``` - #[inline] - #[unstable = "just changed to take self by value"] - fn count(self) -> uint { - self.fold(0, |cnt, _x| cnt + 1) - } - /// Tests whether the predicate holds true for all elements in the iterator. /// /// # Example |
