Skip to content

Commit

Permalink
Remove the iter module.
Browse files Browse the repository at this point in the history
Moves the Times trait to num while the question of whether it should
exist at all gets hashed out as a completely separate question.
  • Loading branch information
jfager committed Aug 29, 2013
1 parent 78c5f97 commit dc30005
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 36 deletions.
26 changes: 0 additions & 26 deletions src/libstd/iter.rs

This file was deleted.

13 changes: 13 additions & 0 deletions src/libstd/num/num.rs
Expand Up @@ -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<Self,Self>
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/num/uint.rs
Expand Up @@ -10,7 +10,7 @@

//! Operations and constants for `uint`

use iter;
use num;
use sys;

pub use self::generated::*;
Expand Down Expand Up @@ -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`,
Expand Down Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/prelude.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/comm.rs
Expand Up @@ -718,7 +718,7 @@ mod test {
use option::*;
use rt::test::*;
use cell::Cell;
use iter::Times;
use num::Times;
use rt::util;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/sched.rs
Expand Up @@ -1114,7 +1114,7 @@ mod test {
#[test]
fn multithreading() {
use rt::comm::*;
use iter::Times;
use num::Times;
use vec::OwnedVector;
use container::Container;

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/select.rs
Expand Up @@ -126,7 +126,7 @@ pub fn select2<TA, A: SelectPort<TA>, TB, B: SelectPort<TB>>(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::*;
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/std.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -220,4 +219,3 @@ mod std {
pub use fmt;
pub use to_bytes;
}

2 changes: 1 addition & 1 deletion src/libstd/str.rs
Expand Up @@ -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};
Expand Down

5 comments on commit dc30005

@bors
Copy link
Contributor

@bors bors commented on dc30005 Aug 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pnkfelix
at jfager@dc30005

@bors
Copy link
Contributor

@bors bors commented on dc30005 Aug 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging jfager/rust/remove-iter-module = dc30005 into auto

@bors
Copy link
Contributor

@bors bors commented on dc30005 Aug 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jfager/rust/remove-iter-module = dc30005 merged ok, testing candidate = a6835dd

@bors
Copy link
Contributor

@bors bors commented on dc30005 Aug 29, 2013

@bors
Copy link
Contributor

@bors bors commented on dc30005 Aug 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a6835dd

Please sign in to comment.