diff options
| author | Chris Wong <lambda.fairy@gmail.com> | 2014-01-25 20:37:51 +1300 |
|---|---|---|
| committer | Chris Wong <lambda.fairy@gmail.com> | 2014-01-25 21:38:25 +1300 |
| commit | 988e4f0a1c2802921375271bdc19f03650c024d2 (patch) | |
| tree | b2d2913ca7575e8e52f2cf6e7975ca2f0f148286 /src/libstd/iter.rs | |
| parent | de57a22b9a8c8416cace31c9bd3ec4c9a6888017 (diff) | |
| download | rust-988e4f0a1c2802921375271bdc19f03650c024d2.tar.gz rust-988e4f0a1c2802921375271bdc19f03650c024d2.zip | |
Uppercase numeric constants
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
Diffstat (limited to 'src/libstd/iter.rs')
| -rw-r--r-- | src/libstd/iter.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index a65da914373..6ae45b1d732 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -681,7 +681,7 @@ pub trait DoubleEndedIterator<A>: Iterator<A> { /// of the original iterator. /// /// Note: Random access with flipped indices still only applies to the first - /// `uint::max_value` elements of the original iterator. + /// `uint::MAX` elements of the original iterator. #[inline] fn rev(self) -> Rev<Self> { Rev{iter: self} @@ -713,7 +713,7 @@ impl<'a, A, T: DoubleEndedIterator<&'a mut A>> MutableDoubleEndedIterator for T /// /// A `RandomAccessIterator` should be either infinite or a `DoubleEndedIterator`. pub trait RandomAccessIterator<A>: Iterator<A> { - /// Return the number of indexable elements. At most `std::uint::max_value` + /// Return the number of indexable elements. At most `std::uint::MAX` /// elements are indexable, even if the iterator represents a longer range. fn indexable(&self) -> uint; @@ -952,7 +952,7 @@ impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> { match self.orig.size_hint() { sz @ (0, Some(0)) => sz, (0, _) => (0, None), - _ => (uint::max_value, None) + _ => (uint::MAX, None) } } } @@ -961,7 +961,7 @@ impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T> #[inline] fn indexable(&self) -> uint { if self.orig.indexable() > 0 { - uint::max_value + uint::MAX } else { 0 } @@ -1823,7 +1823,7 @@ impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> { #[inline] fn size_hint(&self) -> (uint, Option<uint>) { - (uint::max_value, None) // Too bad we can't specify an infinite lower bound + (uint::MAX, None) // Too bad we can't specify an infinite lower bound } } @@ -2049,7 +2049,7 @@ impl<A: Clone> Iterator<A> for Repeat<A> { #[inline] fn next(&mut self) -> Option<A> { self.idx(0) } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { (uint::max_value, None) } + fn size_hint(&self) -> (uint, Option<uint>) { (uint::MAX, None) } } impl<A: Clone> DoubleEndedIterator<A> for Repeat<A> { @@ -2059,7 +2059,7 @@ impl<A: Clone> DoubleEndedIterator<A> for Repeat<A> { impl<A: Clone> RandomAccessIterator<A> for Repeat<A> { #[inline] - fn indexable(&self) -> uint { uint::max_value } + fn indexable(&self) -> uint { uint::MAX } #[inline] fn idx(&self, _: uint) -> Option<A> { Some(self.element.clone()) } } @@ -2417,7 +2417,7 @@ mod tests { fn test_cycle() { let cycle_len = 3; let it = count(0u, 1).take(cycle_len).cycle(); - assert_eq!(it.size_hint(), (uint::max_value, None)); + assert_eq!(it.size_hint(), (uint::MAX, None)); for (i, x) in it.take(100).enumerate() { assert_eq!(i % cycle_len, x); } @@ -2489,19 +2489,19 @@ mod tests { let v2 = &[10, 11, 12]; let vi = v.iter(); - assert_eq!(c.size_hint(), (uint::max_value, None)); + assert_eq!(c.size_hint(), (uint::MAX, None)); assert_eq!(vi.size_hint(), (10, Some(10))); assert_eq!(c.take(5).size_hint(), (5, Some(5))); assert_eq!(c.skip(5).size_hint().second(), None); assert_eq!(c.take_while(|_| false).size_hint(), (0, None)); assert_eq!(c.skip_while(|_| false).size_hint(), (0, None)); - assert_eq!(c.enumerate().size_hint(), (uint::max_value, None)); - assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::max_value, None)); + assert_eq!(c.enumerate().size_hint(), (uint::MAX, None)); + assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::MAX, None)); assert_eq!(c.zip(vi).size_hint(), (10, Some(10))); assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None)); assert_eq!(c.filter(|_| false).size_hint(), (0, None)); - assert_eq!(c.map(|_| 0).size_hint(), (uint::max_value, None)); + assert_eq!(c.map(|_| 0).size_hint(), (uint::MAX, None)); assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None)); assert_eq!(vi.take(5).size_hint(), (5, Some(5))); @@ -2894,7 +2894,7 @@ mod tests { assert_eq!(range(0i, 100).size_hint(), (100, Some(100))); // this test is only meaningful when sizeof uint < sizeof u64 - assert_eq!(range(uint::max_value - 1, uint::max_value).size_hint(), (1, Some(1))); + assert_eq!(range(uint::MAX - 1, uint::MAX).size_hint(), (1, Some(1))); assert_eq!(range(-10i, -1).size_hint(), (9, Some(9))); assert_eq!(range(Foo, Foo).size_hint(), (0, None)); } |
