Skip to content

rename std::iterator to std::iter #9065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/tutorial-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ for i in range(0, 5) {
printf!("%d ", i) // prints "0 1 2 3 4"
}

for i in std::iterator::range_inclusive(0, 5) { // needs explicit import
for i in std::iter::range_inclusive(0, 5) { // needs explicit import
printf!("%d ", i) // prints "0 1 2 3 4 5"
}
~~~
Expand Down
2 changes: 1 addition & 1 deletion src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def emit_decomp_module(f, canon, compat, combine):
+ " bsearch_range_value_table(c, combining_class_table)\n"
+ " }\n\n")
f.write(" fn d(c: char, i: &fn(char), k: bool) {\n")
f.write(" use iterator::Iterator;\n");
f.write(" use iter::Iterator;\n");

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

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/libextra/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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())
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/libextra/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
7 changes: 3 additions & 4 deletions src/libextra/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -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) => {
Expand All @@ -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) } }

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/num/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/libextra/priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use middle::typeck::method_map;
use middle::moves;
use util::ppaux::ty_to_str;

use std::iterator;
use std::iter;
use std::num;
use std::vec;
use extra::sort;
Expand Down Expand Up @@ -282,7 +282,7 @@ pub fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
_ => max_len
}
};
for n in iterator::range(0u, max_len + 1) {
for n in iter::range(0u, max_len + 1) {
match is_useful_specialized(cx, m, v, vec(n), n, left_ty) {
not_useful => (),
ref u => return *u,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/basic_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use lib::llvm::{llvm, BasicBlockRef};
use middle::trans::value::{UserIterator, Value};
use std::iterator::{Filter, Map};
use std::iter::{Filter, Map};

pub struct BasicBlock(BasicBlockRef);

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/at_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use clone::Clone;
use container::Container;
use iterator::Iterator;
use iter::Iterator;
use option::{Option, Some, None};
use sys;
use unstable::raw::Repr;
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
// except according to those terms.

use cast;
use iterator::{Iterator,range};
use iter::{Iterator, range};
use libc;
use ops::Drop;
use option::{Option, Some, None};
use ptr::RawPtr;
use ptr;
use str::StrSlice;
use vec::{ImmutableVector,CopyableVector};
use vec::{ImmutableVector, CopyableVector};
use container::Container;

/// Resolution options for the `null_byte` condition
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use option::{Some, None};
use clone::Clone;
use container::Container;
use cmp::Eq;
use iterator::{Iterator, FilterMap};
use iter::{Iterator, FilterMap};
use result::Result;
use result;
use str::StrSlice;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ macro_rules! upper_hex(($ty:ident, $into:ident) => {
#[doc(hidden)]
pub fn upperhex(buf: &[u8], f: &mut Formatter) {
let mut local = [0u8, ..16];
for i in ::iterator::range(0, buf.len()) {
for i in ::iter::range(0, buf.len()) {
local[i] = match buf[i] as char {
'a' .. 'f' => (buf[i] - 'a' as u8) + 'A' as u8,
c => c as u8,
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/fmt/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use prelude::*;

use char;
use str;
use iterator;

condition! { pub parse_error: ~str -> (); }

Expand Down Expand Up @@ -152,7 +151,7 @@ pub struct Parser<'self> {
priv depth: uint,
}

impl<'self> iterator::Iterator<Piece<'self>> for Parser<'self> {
impl<'self> Iterator<Piece<'self>> for Parser<'self> {
fn next(&mut self) -> Option<Piece<'self>> {
match self.cur.clone().next() {
Some((_, '#')) => { self.cur.next(); Some(CurrentArgument) }
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#[allow(missing_doc)];

use container::Container;
use iterator::Iterator;
use iter::Iterator;
use option::{Some, None};
use rt::io::Writer;
use str::OwnedStr;
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
use clone::Clone;
use cmp::{Eq, Equiv};
use hash::Hash;
use iterator::{Iterator, FromIterator, Extendable};
use iterator::{FilterMap, Chain, Repeat, Zip};
use iter::{Iterator, FromIterator, Extendable};
use iter::{FilterMap, Chain, Repeat, Zip};
use num;
use option::{None, Option, Some};
use rand::RngUtil;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use clone::Clone;
use c_str::ToCStr;
use container::Container;
use int;
use iterator::Iterator;
use iter::Iterator;
use libc::consts::os::posix88::*;
use libc::{c_int, c_void, size_t};
use libc;
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/iterator.rs → src/libstd/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ pub trait Iterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::Counter;
/// use std::iter::count;
///
/// for i in count(0, 10) {
/// printfln!("%d", i);
Expand Down Expand Up @@ -754,7 +754,7 @@ pub trait MultiplicativeIterator<A> {
/// # Example
///
/// ~~~ {.rust}
/// use std::iterator::Counter;
/// use std::iter::count;
///
/// fn factorial(n: uint) -> uint {
/// count(1u, 1).take_while(|&i| i <= n).product()
Expand Down
12 changes: 6 additions & 6 deletions src/libstd/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ use clone::Clone;
use cmp::{Eq,Ord};
use util;
use num::Zero;
use iterator;
use iterator::{Iterator, DoubleEndedIterator, ExactSize};
use iter;
use iter::{Iterator, DoubleEndedIterator, ExactSize};
use str::{StrSlice, OwnedStr};
use to_str::ToStr;
use clone::DeepClone;
Expand All @@ -60,19 +60,19 @@ pub enum Option<T> {

impl<T: Eq + Ord> Ord for Option<T> {
fn lt(&self, other: &Option<T>) -> bool {
iterator::order::lt(self.iter(), other.iter())
iter::order::lt(self.iter(), other.iter())
}

fn le(&self, other: &Option<T>) -> bool {
iterator::order::le(self.iter(), other.iter())
iter::order::le(self.iter(), other.iter())
}

fn ge(&self, other: &Option<T>) -> bool {
iterator::order::ge(self.iter(), other.iter())
iter::order::ge(self.iter(), other.iter())
}

fn gt(&self, other: &Option<T>) -> bool {
iterator::order::gt(self.iter(), other.iter())
iter::order::gt(self.iter(), other.iter())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use c_str::ToCStr;
use clone::Clone;
use container::Container;
use io;
use iterator::range;
use iter::range;
use libc;
use libc::{c_char, c_void, c_int, size_t};
use libc::FILE;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use c_str;
use clone::Clone;
use cmp::Eq;
use container::Container;
use iterator::{Iterator, range};
use iter::{Iterator, range};
use libc;
use num;
use option::{None, Option, Some};
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub use result::{Result, Ok, Err};

// Reexported functions
pub use io::{print, println};
pub use iterator::range;
pub use iter::range;
pub use from_str::from_str;

// Reexported types and traits
Expand All @@ -51,9 +51,9 @@ pub use char::Char;
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use hash::Hash;
pub use num::Times;
pub use iterator::{FromIterator, Extendable};
pub use iterator::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator};
pub use iterator::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
pub use iter::{FromIterator, Extendable};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator};
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
pub use num::{Orderable, Signed, Unsigned, Round};
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
Expand Down
Loading