Stop using the deprecated range function.

This commit is contained in:
Ms2ger 2015-04-22 19:51:17 +02:00
parent c4b7979450
commit 4d41f1c991
17 changed files with 27 additions and 28 deletions

View file

@ -59,7 +59,7 @@ impl Bezier {
fn solve_curve_x(&self, x: f64, epsilon: f64) -> f64 {
// Fast path: Use Newton's method.
let mut t = x;
for _ in range(0, NEWTON_METHOD_ITERATIONS) {
for _ in 0..NEWTON_METHOD_ITERATIONS {
let x2 = self.sample_curve_x(t);
if x2.approx_eq(x, epsilon) {
return t

View file

@ -339,7 +339,7 @@ impl<T: Send + 'static> Drop for Deque<T> {
let a = self.array.load(SeqCst);
// Free whatever is leftover in the dequeue, and then move the buffer
// back into the pool.
for i in range(t, b) {
for i in t..b {
let _: T = unsafe { (*a).get(i) };
}
self.pool.free(unsafe { transmute(a) });
@ -392,7 +392,7 @@ impl<T: Send> Buffer<T> {
// casting delta to usize and then adding gives the desired
// effect.
let buf = Buffer::new(self.log_size.wrapping_add(delta as usize));
for i in range(t, b) {
for i in t..b {
buf.put(i, self.get(i));
}
return buf;

View file

@ -3,11 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::cmp::{max, min};
use std::iter;
use std::fmt;
use std::num;
use std::num::Int;
use std::marker::PhantomData;
use std::num::{self, Int};
use std::ops;
/// An index type to be used by a `Range`
pub trait RangeIndex: Int + fmt::Debug {
@ -239,12 +238,12 @@ impl<I: RangeIndex> fmt::Debug for Range<I> {
/// An iterator over each index in a range
pub struct EachIndex<T, I> {
it: iter::Range<T>,
it: ops::Range<T>,
phantom: PhantomData<I>,
}
pub fn each_index<T: Int, I: RangeIndex<Index=T>>(start: I, stop: I) -> EachIndex<T, I> {
EachIndex { it: iter::range(start.get(), stop.get()), phantom: PhantomData }
EachIndex { it: start.get()..stop.get(), phantom: PhantomData }
}
impl<T: Int, I: RangeIndex<Index=T>> Iterator for EachIndex<T, I> {