diff --git a/Cargo.toml b/Cargo.toml index 58c3b4aa..814ae862 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nalgebra" -version = "0.2.6" +version = "0.2.7" authors = [ "Sébastien Crozet " ] # FIXME: add the contributors. description = "Linear algebra library for computer physics, computer graphics and general low-dimensional linear algebra for Rust." diff --git a/src/lib.rs b/src/lib.rs index f4d1340a..7670f142 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,9 +85,10 @@ Feel free to add your project to this list if you happen to use **nalgebra**! #![feature(unboxed_closures)] #![feature(core)] #![feature(std_misc)] +#![feature(test)] #![doc(html_root_url = "http://nalgebra.org/doc")] -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate rand; #[cfg(feature="arbitrary")] diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index ab3049f0..0838f1de 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -264,7 +264,7 @@ impl Shape<(usize, usize)> for DMat { impl Index<(usize, usize)> for DMat { type Output = N; - fn index(&self, &(i, j): &(usize, usize)) -> &N { + fn index(&self, (i, j): (usize, usize)) -> &N { assert!(i < self.nrows); assert!(j < self.ncols); @@ -275,7 +275,7 @@ impl Index<(usize, usize)> for DMat { } impl IndexMut<(usize, usize)> for DMat { - fn index_mut(&mut self, &(i, j): &(usize, usize)) -> &mut N { + fn index_mut(&mut self, (i, j): (usize, usize)) -> &mut N { assert!(i < self.nrows); assert!(j < self.ncols); diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index dfbc2d1f..15bdef9c 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -67,7 +67,7 @@ macro_rules! dvec_impl( #[inline] unsafe fn unsafe_at(&self, i: usize) -> N { - *self.at.as_slice().get_unchecked(i) + *self.at[..].get_unchecked(i) } #[inline] @@ -80,14 +80,14 @@ macro_rules! dvec_impl( impl Index for $dvec { type Output = N; - fn index(&self, i: &usize) -> &N { - &self.as_slice()[*i] + fn index(&self, i: usize) -> &N { + &self.as_slice()[i] } } impl IndexMut for $dvec { - fn index_mut(&mut self, i: &usize) -> &mut N { - &mut self.as_mut_slice()[*i] + fn index_mut(&mut self, i: usize) -> &mut N { + &mut self.as_mut_slice()[i] } } diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index 5ea2fce7..07067519 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -304,7 +304,7 @@ macro_rules! index_impl( impl Index<(usize, usize)> for $t { type Output = N; - fn index(&self, &(i, j): &(usize, usize)) -> &N { + fn index(&self, (i, j): (usize, usize)) -> &N { unsafe { &mem::transmute::<&$t, &mut [N; $dim * $dim]>(self)[i + j * $dim] } @@ -312,7 +312,7 @@ macro_rules! index_impl( } impl IndexMut<(usize, usize)> for $t { - fn index_mut(&mut self, &(i, j): &(usize, usize)) -> &mut N { + fn index_mut(&mut self, (i, j): (usize, usize)) -> &mut N { unsafe { &mut mem::transmute::<&mut $t, &mut [N; $dim * $dim]>(self)[i + j * $dim] } diff --git a/src/structs/rot_macros.rs b/src/structs/rot_macros.rs index c7e994c5..94928481 100644 --- a/src/structs/rot_macros.rs +++ b/src/structs/rot_macros.rs @@ -234,8 +234,8 @@ macro_rules! index_impl( impl Index<(usize, usize)> for $t { type Output = N; - fn index(&self, i: &(usize, usize)) -> &N { - &self.submat[*i] + fn index(&self, i: (usize, usize)) -> &N { + &self.submat[i] } } ) diff --git a/src/structs/spec/vec0.rs b/src/structs/spec/vec0.rs index 7a0602a5..86380f83 100644 --- a/src/structs/spec/vec0.rs +++ b/src/structs/spec/vec0.rs @@ -26,14 +26,14 @@ impl Index for vec::Vec0 { type Output = N; #[inline] - fn index(&self, _: &usize) -> &N { + fn index(&self, _: usize) -> &N { panic!("Canot index a Vec0.") } } impl IndexMut for vec::Vec0 { #[inline] - fn index_mut(&mut self, _: &usize) -> &mut N { + fn index_mut(&mut self, _: usize) -> &mut N { panic!("Canot index a Vec0.") } } diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index b41d76dd..735d1fa1 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -228,14 +228,14 @@ macro_rules! index_impl( impl Index for $t { type Output = N; - fn index(&self, i: &usize) -> &N { - &self.as_array()[*i] + fn index(&self, i: usize) -> &N { + &self.as_array()[i] } } impl IndexMut for $t { - fn index_mut(&mut self, i: &usize) -> &mut N { - &mut self.as_array_mut()[*i] + fn index_mut(&mut self, i: usize) -> &mut N { + &mut self.as_array_mut()[i] } } ) diff --git a/src/traits/geometry.rs b/src/traits/geometry.rs index 239e0d4f..e9c22678 100644 --- a/src/traits/geometry.rs +++ b/src/traits/geometry.rs @@ -142,6 +142,7 @@ impl + Copy, AV, M: Rotation + Translation> Rotatio /// Trait of transformation having a rotation extractable as a rotation matrix. This can typically /// be implemented by quaternions to convert them to a rotation matrix. pub trait RotationMatrix : Rotation { + /// The output rotation matrix type. type Output: Mat + Rotation; /// Gets the rotation matrix represented by `self`. @@ -230,6 +231,7 @@ pub trait Norm { * Trait of elements having a cross product. */ pub trait Cross { + /// The cross product output. type Output; /// Computes the cross product between two elements (usually vectors). diff --git a/tests/arbitrary.rs b/tests/arbitrary.rs index 788e2170..34886f42 100644 --- a/tests/arbitrary.rs +++ b/tests/arbitrary.rs @@ -1,6 +1,6 @@ #![cfg(feature="arbitrary")] -extern crate "nalgebra" as na; +extern crate nalgebra as na; extern crate quickcheck; extern crate rand; diff --git a/tests/mat.rs b/tests/mat.rs index 764b9c75..c041569a 100644 --- a/tests/mat.rs +++ b/tests/mat.rs @@ -1,4 +1,4 @@ -extern crate "nalgebra" as na; +extern crate nalgebra as na; extern crate rand; use rand::random; diff --git a/tests/quat.rs b/tests/quat.rs index 00375dcf..df30a954 100644 --- a/tests/quat.rs +++ b/tests/quat.rs @@ -1,4 +1,4 @@ -extern crate "nalgebra" as na; +extern crate nalgebra as na; extern crate rand; use na::{Pnt3, Vec3, Rot3, UnitQuat, Rotation}; diff --git a/tests/vec.rs b/tests/vec.rs index 60642842..140dca65 100644 --- a/tests/vec.rs +++ b/tests/vec.rs @@ -1,4 +1,4 @@ -extern crate "nalgebra" as na; +extern crate nalgebra as na; extern crate rand; use rand::random;