diff options
| author | bors <bors@rust-lang.org> | 2014-02-21 09:46:49 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-21 09:46:49 -0800 |
| commit | b5995b4e93237fe0d1c0ea76e33eb2429f654487 (patch) | |
| tree | 0a71ca876e0bdd52f90f6f0a0b24c766ea4ce82d /src/libstd/iter.rs | |
| parent | f8893ed5d97180dc51d82df1bdbab989c4bde46d (diff) | |
| parent | 3a9eca3a7be3ea156147fb8ed00a6447112e74d7 (diff) | |
auto merge of #12326 : bjz/rust/integer, r=alexcrichton
This is part of the effort to simplify `std::num`, as tracked in issue #10387.
Diffstat (limited to 'src/libstd/iter.rs')
| -rw-r--r-- | src/libstd/iter.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 7516a3ddf54..5e919e4ac0a 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -65,7 +65,7 @@ the rest of the rust manuals. */ use cmp; -use num::{Zero, One, Integer, CheckedAdd, CheckedSub, Saturating, ToPrimitive}; +use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int}; use option::{Option, Some, None}; use ops::{Add, Mul, Sub}; use cmp::{Eq, Ord}; @@ -2005,9 +2005,9 @@ impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> { } } -/// `Integer` is required to ensure the range will be the same regardless of +/// `Int` is required to ensure the range will be the same regardless of /// the direction it is consumed. -impl<A: Integer + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> { +impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> { #[inline] fn next_back(&mut self) -> Option<A> { if self.stop > self.state { @@ -2065,7 +2065,7 @@ impl<A: Add<A, A> + Eq + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusi } } -impl<A: Sub<A, A> + Integer + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> +impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for RangeInclusive<A> { #[inline] fn next_back(&mut self) -> Option<A> { @@ -2381,7 +2381,7 @@ mod tests { #[test] fn test_filter_map() { let mut it = count(0u, 1u).take(10) - .filter_map(|x| if x.is_even() { Some(x*x) } else { None }); + .filter_map(|x| if x % 2 == 0 { Some(x*x) } else { None }); assert_eq!(it.collect::<~[uint]>(), ~[0*0, 2*2, 4*4, 6*6, 8*8]); } @@ -2648,7 +2648,7 @@ mod tests { fn test_all() { let v: ~&[int] = ~&[1, 2, 3, 4, 5]; assert!(v.iter().all(|&x| x < 10)); - assert!(!v.iter().all(|&x| x.is_even())); + assert!(!v.iter().all(|&x| x % 2 == 0)); assert!(!v.iter().all(|&x| x > 100)); assert!(v.slice(0, 0).iter().all(|_| fail!())); } @@ -2657,7 +2657,7 @@ mod tests { fn test_any() { let v: ~&[int] = ~&[1, 2, 3, 4, 5]; assert!(v.iter().any(|&x| x < 10)); - assert!(v.iter().any(|&x| x.is_even())); + assert!(v.iter().any(|&x| x % 2 == 0)); assert!(!v.iter().any(|&x| x > 100)); assert!(!v.slice(0, 0).iter().any(|_| fail!())); } |
