Merge pull request #4570 from wting/minor_int_cleanup
minor int-template.rs cleanup
This commit is contained in:
commit
b49c47a4c9
1 changed files with 2 additions and 2 deletions
|
@ -72,7 +72,7 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T }
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
/// Iterate over the range [`lo`..`hi`)
|
/// Iterate over the range [`lo`..`hi`)
|
||||||
pub fn range(lo: T, hi: T, it: fn(T) -> bool) {
|
pub pure fn range(lo: T, hi: T, it: fn(T) -> bool) {
|
||||||
let mut i = lo;
|
let mut i = lo;
|
||||||
while i < hi {
|
while i < hi {
|
||||||
if !it(i) { break }
|
if !it(i) { break }
|
||||||
|
@ -150,7 +150,7 @@ impl T: iter::Times {
|
||||||
`x` is an int, this is functionally equivalent to \
|
`x` is an int, this is functionally equivalent to \
|
||||||
`for int::range(0, x) |_i| { /* anything */ }`."]
|
`for int::range(0, x) |_i| { /* anything */ }`."]
|
||||||
pure fn times(&self, it: fn() -> bool) {
|
pure fn times(&self, it: fn() -> bool) {
|
||||||
if *self < 0 {
|
if is_negative(*self) {
|
||||||
fail fmt!("The .times method expects a nonnegative number, \
|
fail fmt!("The .times method expects a nonnegative number, \
|
||||||
but found %?", self);
|
but found %?", self);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue