Skip to content

Commit ea9c5c4

Browse files
author
blake2-ppc
committed
std: Remove uint::iterate, replaced by range
1 parent 08d0b70 commit ea9c5c4

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

src/libextra/bitv.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,13 @@ impl BigBitv {
206206
#[inline]
207207
pub fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
208208
let len = b.storage.len();
209-
do uint::iterate(0, len) |i| {
209+
for i in range(0, len) {
210210
let mask = big_mask(nbits, i);
211211
if mask & self.storage[i] != mask & b.storage[i] {
212-
false
213-
} else {
214-
true
212+
return false;
215213
}
216214
}
215+
true
217216
}
218217
}
219218

src/libstd/num/uint.rs

-24
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,6 @@ pub fn div_round(x: uint, y: uint) -> uint {
7070
///
7171
pub fn div_floor(x: uint, y: uint) -> uint { return x / y; }
7272

73-
///
74-
/// Iterate over the range [`lo`..`hi`), or stop when requested
75-
///
76-
/// # Arguments
77-
///
78-
/// * lo - The integer at which to start the loop (included)
79-
/// * hi - The integer at which to stop the loop (excluded)
80-
/// * it - A block to execute with each consecutive integer of the range.
81-
/// Return `true` to continue, `false` to stop.
82-
///
83-
/// # Return value
84-
///
85-
/// `true` If execution proceeded correctly, `false` if it was interrupted,
86-
/// that is if `it` returned `false` at any point.
87-
///
88-
pub fn iterate(lo: uint, hi: uint, it: &fn(uint) -> bool) -> bool {
89-
let mut i = lo;
90-
while i < hi {
91-
if (!it(i)) { return false; }
92-
i += 1u;
93-
}
94-
return true;
95-
}
96-
9773
impl iter::Times for uint {
9874
#[inline]
9975
///

src/libstd/ptr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use cast;
1414
use clone::Clone;
15+
use iterator::{range, Iterator};
1516
use option::{Option, Some, None};
1617
use unstable::intrinsics;
1718
use util::swap;
@@ -20,7 +21,6 @@ use util::swap;
2021
#[cfg(not(test))] use num::Int;
2122

2223
#[cfg(not(test))] use cmp::{Eq, Ord};
23-
use uint;
2424

2525
/// Calculate the offset from a pointer
2626
#[inline]
@@ -240,11 +240,10 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
240240
fail!("ptr::array_each_with_len failure: arr input is null pointer");
241241
}
242242
//let start_ptr = *arr;
243-
uint::iterate(0, len, |e| {
243+
for e in range(0, len) {
244244
let n = offset(arr, e as int);
245245
cb(*n);
246-
true
247-
});
246+
}
248247
debug!("array_each_with_len: after iterate");
249248
}
250249

0 commit comments

Comments
 (0)