diff --git a/Cargo.toml b/Cargo.toml index a4a9c77..1170e1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cgmath" -version = "0.1.0" +version = "0.1.1" authors = ["Brendan Zabarauskas ", "Brian Heylin", "Colin Sherratt", @@ -20,6 +20,8 @@ repository="https://github.com/bjz/cgmath-rs" [lib] name = "cgmath" +[dependencies.rustc-serialize] +rustc_serialize = "*" + [dependencies] -rustc-serialize="*" -rand="*" +rand = "*" diff --git a/src/lib.rs b/src/lib.rs index 9a49f5b..51983f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ //! `look_at`, `from_angle`, `from_euler`, and `from_axis_angle` methods. //! These are provided for convenience. -extern crate "rustc-serialize" as rustc_serialize; +extern crate rustc_serialize; extern crate rand; // Re-exports diff --git a/src/matrix.rs b/src/matrix.rs index 9a10ab6..2d7f9e6 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -545,15 +545,15 @@ impl Index for Matrix2 { type Output = Vector2; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a Vector2 { - FixedArray::from_fixed_ref(&self.as_fixed()[*i]) + fn index<'a>(&'a self, i: usize) -> &'a Vector2 { + FixedArray::from_fixed_ref(&self.as_fixed()[i]) } } impl IndexMut for Matrix2 { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut Vector2 { - FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[*i]) + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vector2 { + FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[i]) } } @@ -627,15 +627,15 @@ impl Index for Matrix3 { type Output = Vector3; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a Vector3 { - FixedArray::from_fixed_ref(&self.as_fixed()[*i]) + fn index<'a>(&'a self, i: usize) -> &'a Vector3 { + FixedArray::from_fixed_ref(&self.as_fixed()[i]) } } impl IndexMut for Matrix3 { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut Vector3 { - FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[*i]) + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vector3 { + FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[i]) } } @@ -714,15 +714,15 @@ impl Index for Matrix4 { type Output = Vector4; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a Vector4 { - FixedArray::from_fixed_ref(&self.as_fixed()[*i]) + fn index<'a>(&'a self, i: usize) -> &'a Vector4 { + FixedArray::from_fixed_ref(&self.as_fixed()[i]) } } impl IndexMut for Matrix4 { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut Vector4 { - FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[*i]) + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vector4 { + FixedArray::from_fixed_mut(&mut self.as_mut_fixed()[i]) } } diff --git a/src/point.rs b/src/point.rs index 27697c0..03923ef 100644 --- a/src/point.rs +++ b/src/point.rs @@ -147,15 +147,15 @@ impl FixedArray<[S; 2]> for Point2 { impl Index for Point2 { type Output = S; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a S { - &self.as_fixed()[*i] + fn index<'a>(&'a self, i: usize) -> &'a S { + &self.as_fixed()[i] } } impl IndexMut for Point2 { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut S { - &mut self.as_mut_fixed()[*i] + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S { + &mut self.as_mut_fixed()[i] } } @@ -303,15 +303,15 @@ impl Index for Point3 { type Output = S; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a S { - &self.as_fixed()[*i] + fn index<'a>(&'a self, i: usize) -> &'a S { + &self.as_fixed()[i] } } impl IndexMut for Point3 { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut S { - &mut self.as_mut_fixed()[*i] + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S { + &mut self.as_mut_fixed()[i] } } diff --git a/src/quaternion.rs b/src/quaternion.rs index fdbe73e..7d48b1a 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -57,17 +57,17 @@ impl Index for Quaternion { type Output = S; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a S { + fn index<'a>(&'a self, i: usize) -> &'a S { let slice: &[S; 4] = unsafe { mem::transmute(self) }; - &slice[*i] + &slice[i] } } impl IndexMut for Quaternion { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut S { + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S { let slice: &'a mut [S; 4] = unsafe { mem::transmute(self) }; - &mut slice[*i] + &mut slice[i] } } diff --git a/src/rotation.rs b/src/rotation.rs index 2a45328..8e92d31 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -133,6 +133,7 @@ pub trait Rotation3: Rotation, Point3> /// matrix: /// /// ```no_run +/// #![feature(core)] /// use cgmath::rad; /// use cgmath::Vector2; /// use cgmath::{Matrix, ToMatrix2}; diff --git a/src/vector.rs b/src/vector.rs index 5b33aa3..7f32b8e 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -267,15 +267,15 @@ macro_rules! vec( type Output = S; #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a $S { - &self.as_fixed()[*i] + fn index<'a>(&'a self, i: usize) -> &'a $S { + &self.as_fixed()[i] } } impl<$S: Copy> IndexMut for $Self_<$S> { #[inline] - fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut $S { - &mut self.as_mut_fixed()[*i] + fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut $S { + &mut self.as_mut_fixed()[i] } } diff --git a/tests/quaternion.rs b/tests/quaternion.rs index 05c46f7..6b0dcf2 100644 --- a/tests/quaternion.rs +++ b/tests/quaternion.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![feature(core)] extern crate cgmath;