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

@ -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> {