diff --git a/src/lib.rs b/src/lib.rs index a7373772..f4d1340a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,7 +83,6 @@ Feel free to add your project to this list if you happen to use **nalgebra**! #![deny(unused_results)] #![warn(missing_docs)] #![feature(unboxed_closures)] -#![feature(hash)] #![feature(core)] #![feature(std_misc)] #![doc(html_root_url = "http://nalgebra.org/doc")] diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index 58d7703f..8f9dcb9b 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -3,7 +3,7 @@ #![allow(missing_docs)] // we hide doc to not have to document the $trhs double dispatch trait. use std::slice::{Iter, IterMut}; -use std::iter::FromIterator; +use std::iter::{FromIterator, IntoIterator}; use std::iter::repeat; use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut}; use rand::{self, Rand}; @@ -68,8 +68,8 @@ impl DVec { impl FromIterator for DVec { #[inline] - fn from_iter>(param: I) -> DVec { - DVec { at: param.collect() } + fn from_iter>(param: I) -> DVec { + DVec { at: param.into_iter().collect() } } } diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index 056a4640..1dfda926 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -497,12 +497,12 @@ macro_rules! small_dvec_from_impl ( impl FromIterator for $dvec { #[inline] - fn from_iter>(param: I) -> $dvec { + fn from_iter>(param: I) -> $dvec { let mut at: [N; $dim] = [ $( $zeros, )* ]; let mut dim = 0; - for n in param { + for n in param.into_iter() { if dim == $dim { break; } diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index 3bcf273f..4dfde695 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -2,9 +2,10 @@ #![allow(missing_docs)] // we allow missing to avoid having to document the point components. +use std::marker::PhantomData; use std::mem; use std::slice::{Iter, IterMut}; -use std::iter::{Iterator, FromIterator}; +use std::iter::{Iterator, FromIterator, IntoIterator}; use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut}; use rand::{Rand, Rng}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, @@ -18,20 +19,20 @@ use quickcheck::{Arbitrary, Gen}; /// Point of dimension 0. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] -pub struct Pnt0; +#[derive(Eq, PartialEq, Clone, Debug, Copy)] +pub struct Pnt0(pub PhantomData); impl Pnt0 { /// Creates a new point. #[inline] pub fn new() -> Pnt0 { - Pnt0 + Pnt0(PhantomData) } /// Creates a new point. The parameter is not taken in account. #[inline] pub fn new_repeat(_: N) -> Pnt0 { - Pnt0 + Pnt0(PhantomData) } } diff --git a/src/structs/quat.rs b/src/structs/quat.rs index 057eee1c..98afa714 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -6,7 +6,7 @@ use std::mem; use std::num; use std::slice::{Iter, IterMut}; use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut}; -use std::iter::FromIterator; +use std::iter::{FromIterator, IntoIterator}; use rand::{Rand, Rng}; use structs::{Vec3, Pnt3, Rot3, Mat3}; use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, diff --git a/src/structs/spec/vec0.rs b/src/structs/spec/vec0.rs index 87761f35..7a0602a5 100644 --- a/src/structs/spec/vec0.rs +++ b/src/structs/spec/vec0.rs @@ -1,7 +1,8 @@ use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut}; +use std::marker::PhantomData; use std::mem; use std::slice::{Iter, IterMut}; -use std::iter::{Iterator, FromIterator}; +use std::iter::{FromIterator, IntoIterator}; use rand::{Rand, Rng}; use traits::operations::ApproxEq; use traits::structure::{Iterable, IterableMut, Indexable, Basis, Dim, Shape, BaseFloat, BaseNum, @@ -12,7 +13,7 @@ use structs::vec; impl Zero for vec::Vec0 { #[inline] fn zero() -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } #[inline] @@ -107,7 +108,7 @@ impl Add for vec::Vec0 { #[inline] fn add(self, _: T) -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } @@ -116,7 +117,7 @@ impl Sub for vec::Vec0 { #[inline] fn sub(self, _: T) -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } @@ -125,7 +126,7 @@ impl + Copy> Neg for vec::Vec0 { #[inline] fn neg(self) -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } @@ -141,7 +142,7 @@ impl Mul for vec::Vec0 { #[inline] fn mul(self, _: T) -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } @@ -150,7 +151,7 @@ impl Div for vec::Vec0 { #[inline] fn div(self, _: T) -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } @@ -236,30 +237,30 @@ impl> ApproxEq for vec::Vec0 { impl One for vec::Vec0 { #[inline] fn one() -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } impl FromIterator for vec::Vec0 { #[inline] - fn from_iter>(_: I) -> vec::Vec0 { - vec::Vec0 + fn from_iter>(_: I) -> vec::Vec0 { + vec::Vec0(PhantomData) } } impl Bounded for vec::Vec0 { #[inline] fn max_value() -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } #[inline] fn min_value() -> vec::Vec0 { - vec::Vec0 + vec::Vec0(PhantomData) } } impl Rand for vec::Vec0 { #[inline] - fn rand(_: &mut R) -> vec::Vec0 { vec::Vec0 } + fn rand(_: &mut R) -> vec::Vec0 { vec::Vec0(PhantomData) } } diff --git a/src/structs/vec.rs b/src/structs/vec.rs index bc8afff8..f8a52c00 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -3,9 +3,10 @@ #![allow(missing_docs)] // we allow missing to avoid having to document the dispatch traits. use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut}; +use std::marker::PhantomData; use std::mem; use std::slice::{Iter, IterMut}; -use std::iter::{Iterator, FromIterator}; +use std::iter::{Iterator, FromIterator, IntoIterator}; use rand::{Rand, Rng}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Absolute}; @@ -20,20 +21,20 @@ use quickcheck::{Arbitrary, Gen}; /// Vector of dimension 0. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] -pub struct Vec0; +#[derive(Eq, PartialEq, Clone, Debug, Copy)] +pub struct Vec0(pub PhantomData); impl Vec0 { /// Creates a new vector. #[inline] pub fn new() -> Vec0 { - Vec0 + Vec0(PhantomData) } /// Creates a new vector. The parameter is not taken in account. #[inline] pub fn new_repeat(_: N) -> Vec0 { - Vec0 + Vec0(PhantomData) } } diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 4dac962c..ade4eac3 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -680,7 +680,8 @@ macro_rules! from_iterator_impl( ($t: ident, $param0: ident) => ( impl FromIterator for $t { #[inline] - fn from_iter>(mut $param0: I) -> $t { + fn from_iter>($param0: I) -> $t { + let mut $param0 = $param0.into_iter(); $t::new($param0.next().unwrap()) } } @@ -688,7 +689,8 @@ macro_rules! from_iterator_impl( ($t: ident, $param0: ident, $($paramN: ident),+) => ( impl FromIterator for $t { #[inline] - fn from_iter>(mut $param0: I) -> $t { + fn from_iter>($param0: I) -> $t { + let mut $param0 = $param0.into_iter(); $t::new($param0.next().unwrap(), $($paramN.next().unwrap()),+) }