We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3fac6f8 + 04d38f3 commit b49c47aCopy full SHA for b49c47a
src/libcore/int-template.rs
@@ -72,7 +72,7 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T }
72
73
#[inline(always)]
74
/// Iterate over the range [`lo`..`hi`)
75
-pub fn range(lo: T, hi: T, it: fn(T) -> bool) {
+pub pure fn range(lo: T, hi: T, it: fn(T) -> bool) {
76
let mut i = lo;
77
while i < hi {
78
if !it(i) { break }
@@ -150,7 +150,7 @@ impl T: iter::Times {
150
`x` is an int, this is functionally equivalent to \
151
`for int::range(0, x) |_i| { /* anything */ }`."]
152
pure fn times(&self, it: fn() -> bool) {
153
- if *self < 0 {
+ if is_negative(*self) {
154
fail fmt!("The .times method expects a nonnegative number, \
155
but found %?", self);
156
}
0 commit comments