diff options
| author | bors <bors@rust-lang.org> | 2013-09-09 00:26:07 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-09 00:26:07 -0700 |
| commit | d09f569aac99a4ef2f577d288d547504e3dcf588 (patch) | |
| tree | 339ac953153d71da8730569b8bd26b41dc081539 /src/libextra | |
| parent | eae327032c775813eeb101233a4f7df24eab0a6a (diff) | |
| parent | 6919cf5fe14701621437fcb57f3a0c38fb394c65 (diff) | |
| download | rust-d09f569aac99a4ef2f577d288d547504e3dcf588.tar.gz rust-d09f569aac99a4ef2f577d288d547504e3dcf588.zip | |
auto merge of #9065 : thestinger/rust/iter, r=alexcrichton
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/bitv.rs | 4 | ||||
| -rw-r--r-- | src/libextra/dlist.rs | 16 | ||||
| -rw-r--r-- | src/libextra/enum_set.rs | 2 | ||||
| -rw-r--r-- | src/libextra/json.rs | 7 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 4 | ||||
| -rw-r--r-- | src/libextra/priority_queue.rs | 1 | ||||
| -rw-r--r-- | src/libextra/ringbuf.rs | 6 | ||||
| -rw-r--r-- | src/libextra/smallintmap.rs | 2 | ||||
| -rw-r--r-- | src/libextra/treemap.rs | 2 |
9 files changed, 20 insertions, 24 deletions
diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index 70fd3a01ca4..780527e4532 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -12,8 +12,8 @@ use std::cmp; -use std::iterator::RandomAccessIterator; -use std::iterator::{Invert, Enumerate, Repeat, Map, Zip}; +use std::iter::RandomAccessIterator; +use std::iter::{Invert, Enumerate, Repeat, Map, Zip}; use std::num; use std::ops; use std::uint; diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs index 64bb17a6271..ac296ad527e 100644 --- a/src/libextra/dlist.rs +++ b/src/libextra/dlist.rs @@ -25,8 +25,8 @@ use std::cast; use std::ptr; use std::util; -use std::iterator::{FromIterator, Extendable, Invert}; -use std::iterator; +use std::iter::Invert; +use std::iter; use container::Deque; @@ -593,27 +593,27 @@ impl<A> Extendable<A> for DList<A> { impl<A: Eq> Eq for DList<A> { fn eq(&self, other: &DList<A>) -> bool { self.len() == other.len() && - iterator::order::eq(self.iter(), other.iter()) + iter::order::eq(self.iter(), other.iter()) } fn ne(&self, other: &DList<A>) -> bool { self.len() != other.len() || - iterator::order::ne(self.iter(), other.iter()) + iter::order::ne(self.iter(), other.iter()) } } impl<A: Eq + Ord> Ord for DList<A> { fn lt(&self, other: &DList<A>) -> bool { - iterator::order::lt(self.iter(), other.iter()) + iter::order::lt(self.iter(), other.iter()) } fn le(&self, other: &DList<A>) -> bool { - iterator::order::le(self.iter(), other.iter()) + iter::order::le(self.iter(), other.iter()) } fn gt(&self, other: &DList<A>) -> bool { - iterator::order::gt(self.iter(), other.iter()) + iter::order::gt(self.iter(), other.iter()) } fn ge(&self, other: &DList<A>) -> bool { - iterator::order::ge(self.iter(), other.iter()) + iter::order::ge(self.iter(), other.iter()) } } diff --git a/src/libextra/enum_set.rs b/src/libextra/enum_set.rs index 2b1246b0af0..242faa2b4da 100644 --- a/src/libextra/enum_set.rs +++ b/src/libextra/enum_set.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::iterator::Iterator; - #[deriving(Clone, Eq, IterBytes, ToStr)] /// A specialized Set implementation to use enum types. pub struct EnumSet<E> { diff --git a/src/libextra/json.rs b/src/libextra/json.rs index ee3e1966fe2..f76dc05b277 100644 --- a/src/libextra/json.rs +++ b/src/libextra/json.rs @@ -18,7 +18,6 @@ use std::char; use std::cast::transmute; -use std::iterator; use std::float; use std::hashmap::HashMap; use std::io::WriterUtil; @@ -489,7 +488,7 @@ pub struct Parser<T> { } /// Decode a json value from an Iterator<char> -pub fn Parser<T : iterator::Iterator<char>>(rdr: ~T) -> Parser<T> { +pub fn Parser<T : Iterator<char>>(rdr: ~T) -> Parser<T> { let mut p = Parser { rdr: rdr, ch: '\x00', @@ -500,7 +499,7 @@ pub fn Parser<T : iterator::Iterator<char>>(rdr: ~T) -> Parser<T> { p } -impl<T: iterator::Iterator<char>> Parser<T> { +impl<T: Iterator<char>> Parser<T> { pub fn parse(&mut self) -> Result<Json, Error> { match self.parse_value() { Ok(value) => { @@ -518,7 +517,7 @@ impl<T: iterator::Iterator<char>> Parser<T> { } } -impl<T : iterator::Iterator<char>> Parser<T> { +impl<T : Iterator<char>> Parser<T> { // FIXME: #8971: unsound fn eof(&self) -> bool { self.ch == unsafe { transmute(-1u32) } } diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index cb764228155..2e61b7fdbdc 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -2011,13 +2011,13 @@ mod bigint_tests { #[cfg(test)] mod bench { use super::*; - use std::{iterator, util}; + use std::{iter, util}; use std::num::{Zero, One}; use extra::test::BenchHarness; fn factorial(n: uint) -> BigUint { let mut f: BigUint = One::one(); - for i in iterator::range_inclusive(1, n) { + for i in iter::range_inclusive(1, n) { f = f * BigUint::from_uint(i); } f diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index b085981aabb..6dd4759d927 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -16,7 +16,6 @@ use std::clone::Clone; use std::unstable::intrinsics::{move_val_init, init}; use std::util::{replace, swap}; use std::vec; -use std::iterator::{FromIterator, Extendable}; /// A priority queue implemented with a binary heap #[deriving(Clone)] diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs index 9ae9b47e207..ea8537caeb5 100644 --- a/src/libextra/ringbuf.rs +++ b/src/libextra/ringbuf.rs @@ -15,7 +15,7 @@ use std::num; use std::vec; -use std::iterator::{FromIterator, Invert, RandomAccessIterator, Extendable}; +use std::iter::{Invert, RandomAccessIterator}; use container::Deque; @@ -694,13 +694,13 @@ mod tests { #[test] fn test_from_iterator() { - use std::iterator; + use std::iter; let v = ~[1,2,3,4,5,6,7]; let deq: RingBuf<int> = v.iter().map(|&x| x).collect(); let u: ~[int] = deq.iter().map(|&x| x).collect(); assert_eq!(u, v); - let mut seq = iterator::count(0u, 2).take(256); + let mut seq = iter::count(0u, 2).take(256); let deq: RingBuf<uint> = seq.collect(); for (i, &x) in deq.iter().enumerate() { assert_eq!(2*i, x); diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index ac07fd2bebf..983247971d3 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -15,7 +15,7 @@ #[allow(missing_doc)]; -use std::iterator::{Iterator, Enumerate, FilterMap, Invert}; +use std::iter::{Enumerate, FilterMap, Invert}; use std::util::replace; use std::vec::{VecIterator, VecMutIterator}; use std::vec; diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 307de43a067..99643e643b7 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -14,7 +14,7 @@ use std::util::{swap, replace}; -use std::iterator::{FromIterator, Extendable, Peekable}; +use std::iter::{Peekable}; use std::cmp::Ordering; // This is implemented as an AA tree, which is a simplified variation of |
