From dc30005ad8723ac1ace05340622c51ea9d6a3fd6 Mon Sep 17 00:00:00 2001 From: Jason Fager Date: Thu, 29 Aug 2013 01:27:24 -0400 Subject: [PATCH] Remove the iter module. Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question. --- src/libstd/iter.rs | 26 -------------------------- src/libstd/num/num.rs | 13 +++++++++++++ src/libstd/num/uint.rs | 6 +++--- src/libstd/prelude.rs | 2 +- src/libstd/rt/comm.rs | 2 +- src/libstd/rt/sched.rs | 2 +- src/libstd/select.rs | 2 +- src/libstd/std.rs | 2 -- src/libstd/str.rs | 2 +- 9 files changed, 21 insertions(+), 36 deletions(-) delete mode 100644 src/libstd/iter.rs diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs deleted file mode 100644 index ce528bc9522..00000000000 --- a/src/libstd/iter.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -/*! Times trait - -~~~ {.rust} -use iter::Times; -let ten = 10 as uint; -let mut accum = 0; -do ten.times { accum += 1; } -~~~ - -*/ - -#[allow(missing_doc)] -pub trait Times { - fn times(&self, it: &fn()); -} - diff --git a/src/libstd/num/num.rs b/src/libstd/num/num.rs index 80ab0caac67..3cb110d8464 100644 --- a/src/libstd/num/num.rs +++ b/src/libstd/num/num.rs @@ -80,6 +80,19 @@ pub trait Signed: Num pub trait Unsigned: Num {} +/// Times trait +/// +/// ~~~ {.rust} +/// use num::Times; +/// let ten = 10 as uint; +/// let mut accum = 0; +/// do ten.times { accum += 1; } +/// ~~~ +/// +pub trait Times { + fn times(&self, it: &fn()); +} + pub trait Integer: Num + Orderable + Div diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs index 86bc98e53fc..e23bdc576d3 100644 --- a/src/libstd/num/uint.rs +++ b/src/libstd/num/uint.rs @@ -10,7 +10,7 @@ //! Operations and constants for `uint` -use iter; +use num; use sys; pub use self::generated::*; @@ -70,7 +70,7 @@ pub fn div_round(x: uint, y: uint) -> uint { /// pub fn div_floor(x: uint, y: uint) -> uint { return x / y; } -impl iter::Times for uint { +impl num::Times for uint { #[inline] /// /// A convenience form for basic repetition. Given a uint `x`, @@ -162,7 +162,7 @@ fn test_div() { #[test] pub fn test_times() { - use iter::Times; + use num::Times; let ten = 10 as uint; let mut accum = 0; do ten.times { accum += 1; } diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index bfe5b498f8f..24b3dc20260 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -49,7 +49,7 @@ pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Great pub use char::Char; pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; pub use hash::Hash; -pub use iter::Times; +pub use num::Times; pub use iterator::{FromIterator, Extendable}; pub use iterator::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator}; pub use iterator::{OrdIterator, MutableDoubleEndedIterator}; diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 4b1881409f4..4f5f26513b4 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -718,7 +718,7 @@ mod test { use option::*; use rt::test::*; use cell::Cell; - use iter::Times; + use num::Times; use rt::util; #[test] diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index b393832871d..6aa66a6ab6b 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -1114,7 +1114,7 @@ mod test { #[test] fn multithreading() { use rt::comm::*; - use iter::Times; + use num::Times; use vec::OwnedVector; use container::Container; diff --git a/src/libstd/select.rs b/src/libstd/select.rs index f121158d4c5..d0afeb4be85 100644 --- a/src/libstd/select.rs +++ b/src/libstd/select.rs @@ -126,7 +126,7 @@ pub fn select2, TB, B: SelectPort>(mut a: A, mut b: B) mod test { use super::*; use clone::Clone; - use iter::Times; + use num::Times; use option::*; use rt::comm::*; use rt::test::*; diff --git a/src/libstd/std.rs b/src/libstd/std.rs index ad3e4368daa..0d754323727 100644 --- a/src/libstd/std.rs +++ b/src/libstd/std.rs @@ -140,7 +140,6 @@ pub mod borrow; pub mod from_str; #[path = "num/num.rs"] pub mod num; -pub mod iter; pub mod iterator; pub mod to_str; pub mod to_bytes; @@ -220,4 +219,3 @@ mod std { pub use fmt; pub use to_bytes; } - diff --git a/src/libstd/str.rs b/src/libstd/str.rs index e6cadd04a5b..b24d48e93b5 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -21,7 +21,7 @@ use char; use char::Char; use clone::{Clone, DeepClone}; use container::{Container, Mutable}; -use iter::Times; +use num::Times; use iterator::{Iterator, FromIterator, Extendable}; use iterator::{Filter, AdditiveIterator, Map}; use iterator::{Invert, DoubleEndedIterator};