Fix iterator mutability

For loops now consume iterators.
This commit is contained in:
Eduard Bopp 2015-02-17 13:45:25 +01:00
parent f14f240aa7
commit d368270ebc
2 changed files with 3 additions and 9 deletions

View File

@ -68,14 +68,8 @@ impl<N> DVec<N> {
impl<N> FromIterator<N> for DVec<N> { impl<N> FromIterator<N> for DVec<N> {
#[inline] #[inline]
fn from_iter<I: Iterator<Item = N>>(mut param: I) -> DVec<N> { fn from_iter<I: Iterator<Item = N>>(param: I) -> DVec<N> {
let mut res = DVec { at: Vec::new() }; DVec { at: param.collect() }
for e in param {
res.at.push(e)
}
res
} }
} }

View File

@ -497,7 +497,7 @@ macro_rules! small_dvec_from_impl (
impl<N: Zero> FromIterator<N> for $dvec<N> { impl<N: Zero> FromIterator<N> for $dvec<N> {
#[inline] #[inline]
fn from_iter<I: Iterator<Item = N>>(mut param: I) -> $dvec<N> { fn from_iter<I: Iterator<Item = N>>(param: I) -> $dvec<N> {
let mut at: [N; $dim] = [ $( $zeros, )* ]; let mut at: [N; $dim] = [ $( $zeros, )* ];
let mut dim = 0; let mut dim = 0;