Skip to content

Commit d09f569

Browse files
committed
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.
2 parents eae3270 + 6919cf5 commit d09f569

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+89
-95
lines changed

doc/tutorial-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ for i in range(0, 5) {
200200
printf!("%d ", i) // prints "0 1 2 3 4"
201201
}
202202

203-
for i in std::iterator::range_inclusive(0, 5) { // needs explicit import
203+
for i in std::iter::range_inclusive(0, 5) { // needs explicit import
204204
printf!("%d ", i) // prints "0 1 2 3 4 5"
205205
}
206206
~~~

src/etc/unicode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def emit_decomp_module(f, canon, compat, combine):
310310
+ " bsearch_range_value_table(c, combining_class_table)\n"
311311
+ " }\n\n")
312312
f.write(" fn d(c: char, i: &fn(char), k: bool) {\n")
313-
f.write(" use iterator::Iterator;\n");
313+
f.write(" use iter::Iterator;\n");
314314

315315
f.write(" if c <= '\\x7f' { i(c); return; }\n")
316316

src/libextra/bitv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313

1414
use std::cmp;
15-
use std::iterator::RandomAccessIterator;
16-
use std::iterator::{Invert, Enumerate, Repeat, Map, Zip};
15+
use std::iter::RandomAccessIterator;
16+
use std::iter::{Invert, Enumerate, Repeat, Map, Zip};
1717
use std::num;
1818
use std::ops;
1919
use std::uint;

src/libextra/dlist.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
use std::cast;
2626
use std::ptr;
2727
use std::util;
28-
use std::iterator::{FromIterator, Extendable, Invert};
29-
use std::iterator;
28+
use std::iter::Invert;
29+
use std::iter;
3030

3131
use container::Deque;
3232

@@ -593,27 +593,27 @@ impl<A> Extendable<A> for DList<A> {
593593
impl<A: Eq> Eq for DList<A> {
594594
fn eq(&self, other: &DList<A>) -> bool {
595595
self.len() == other.len() &&
596-
iterator::order::eq(self.iter(), other.iter())
596+
iter::order::eq(self.iter(), other.iter())
597597
}
598598

599599
fn ne(&self, other: &DList<A>) -> bool {
600600
self.len() != other.len() ||
601-
iterator::order::ne(self.iter(), other.iter())
601+
iter::order::ne(self.iter(), other.iter())
602602
}
603603
}
604604

605605
impl<A: Eq + Ord> Ord for DList<A> {
606606
fn lt(&self, other: &DList<A>) -> bool {
607-
iterator::order::lt(self.iter(), other.iter())
607+
iter::order::lt(self.iter(), other.iter())
608608
}
609609
fn le(&self, other: &DList<A>) -> bool {
610-
iterator::order::le(self.iter(), other.iter())
610+
iter::order::le(self.iter(), other.iter())
611611
}
612612
fn gt(&self, other: &DList<A>) -> bool {
613-
iterator::order::gt(self.iter(), other.iter())
613+
iter::order::gt(self.iter(), other.iter())
614614
}
615615
fn ge(&self, other: &DList<A>) -> bool {
616-
iterator::order::ge(self.iter(), other.iter())
616+
iter::order::ge(self.iter(), other.iter())
617617
}
618618
}
619619

src/libextra/enum_set.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::iterator::Iterator;
12-
1311
#[deriving(Clone, Eq, IterBytes, ToStr)]
1412
/// A specialized Set implementation to use enum types.
1513
pub struct EnumSet<E> {

src/libextra/json.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
1919
use std::char;
2020
use std::cast::transmute;
21-
use std::iterator;
2221
use std::float;
2322
use std::hashmap::HashMap;
2423
use std::io::WriterUtil;
@@ -489,7 +488,7 @@ pub struct Parser<T> {
489488
}
490489

491490
/// Decode a json value from an Iterator<char>
492-
pub fn Parser<T : iterator::Iterator<char>>(rdr: ~T) -> Parser<T> {
491+
pub fn Parser<T : Iterator<char>>(rdr: ~T) -> Parser<T> {
493492
let mut p = Parser {
494493
rdr: rdr,
495494
ch: '\x00',
@@ -500,7 +499,7 @@ pub fn Parser<T : iterator::Iterator<char>>(rdr: ~T) -> Parser<T> {
500499
p
501500
}
502501

503-
impl<T: iterator::Iterator<char>> Parser<T> {
502+
impl<T: Iterator<char>> Parser<T> {
504503
pub fn parse(&mut self) -> Result<Json, Error> {
505504
match self.parse_value() {
506505
Ok(value) => {
@@ -518,7 +517,7 @@ impl<T: iterator::Iterator<char>> Parser<T> {
518517
}
519518
}
520519

521-
impl<T : iterator::Iterator<char>> Parser<T> {
520+
impl<T : Iterator<char>> Parser<T> {
522521
// FIXME: #8971: unsound
523522
fn eof(&self) -> bool { self.ch == unsafe { transmute(-1u32) } }
524523

src/libextra/num/bigint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,13 +2011,13 @@ mod bigint_tests {
20112011
#[cfg(test)]
20122012
mod bench {
20132013
use super::*;
2014-
use std::{iterator, util};
2014+
use std::{iter, util};
20152015
use std::num::{Zero, One};
20162016
use extra::test::BenchHarness;
20172017

20182018
fn factorial(n: uint) -> BigUint {
20192019
let mut f: BigUint = One::one();
2020-
for i in iterator::range_inclusive(1, n) {
2020+
for i in iter::range_inclusive(1, n) {
20212021
f = f * BigUint::from_uint(i);
20222022
}
20232023
f

src/libextra/priority_queue.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::clone::Clone;
1616
use std::unstable::intrinsics::{move_val_init, init};
1717
use std::util::{replace, swap};
1818
use std::vec;
19-
use std::iterator::{FromIterator, Extendable};
2019

2120
/// A priority queue implemented with a binary heap
2221
#[deriving(Clone)]

src/libextra/ringbuf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
use std::num;
1717
use std::vec;
18-
use std::iterator::{FromIterator, Invert, RandomAccessIterator, Extendable};
18+
use std::iter::{Invert, RandomAccessIterator};
1919

2020
use container::Deque;
2121

@@ -694,13 +694,13 @@ mod tests {
694694

695695
#[test]
696696
fn test_from_iterator() {
697-
use std::iterator;
697+
use std::iter;
698698
let v = ~[1,2,3,4,5,6,7];
699699
let deq: RingBuf<int> = v.iter().map(|&x| x).collect();
700700
let u: ~[int] = deq.iter().map(|&x| x).collect();
701701
assert_eq!(u, v);
702702

703-
let mut seq = iterator::count(0u, 2).take(256);
703+
let mut seq = iter::count(0u, 2).take(256);
704704
let deq: RingBuf<uint> = seq.collect();
705705
for (i, &x) in deq.iter().enumerate() {
706706
assert_eq!(2*i, x);

src/libextra/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#[allow(missing_doc)];
1717

18-
use std::iterator::{Iterator, Enumerate, FilterMap, Invert};
18+
use std::iter::{Enumerate, FilterMap, Invert};
1919
use std::util::replace;
2020
use std::vec::{VecIterator, VecMutIterator};
2121
use std::vec;

0 commit comments

Comments
 (0)