diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-02-17 07:20:01 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-02-22 01:45:29 +1100 |
| commit | 3a9eca3a7be3ea156147fb8ed00a6447112e74d7 (patch) | |
| tree | 9d1d53b859766fcb40a293ab43fb5d235bc981ea /src/libstd/iter.rs | |
| parent | 2fa7d6b44fcc329e849f4dd43e11c6fdd43ebd76 (diff) | |
| download | rust-3a9eca3a7be3ea156147fb8ed00a6447112e74d7.tar.gz rust-3a9eca3a7be3ea156147fb8ed00a6447112e74d7.zip | |
Move std::num::Integer to libnum
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!())); } |
