From 968adcd2cbe794f4fb1442cfd8dd07f3d816d190 Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Sun, 21 Dec 2014 18:28:59 +0100 Subject: [PATCH] Update to match latest Neg trait. --- src/angle.rs | 6 +++--- src/matrix.rs | 6 +++--- src/quaternion.rs | 2 +- src/vector.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/angle.rs b/src/angle.rs index a1d2de8..b73baf1 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -89,7 +89,7 @@ pub trait Angle fn from>(theta: A) -> Self; /// Negate this angle, in-place. - #[inline] fn neg_self(&mut self) { *self = -*self } + #[inline] fn neg_self(&mut self) { *self = -(*self).clone() } /// Add this angle with another, returning the new angle. #[inline] fn add_a(&self, other: Self) -> Self { ScalarConv::from(*self.s() + *other.s()) } @@ -186,8 +186,8 @@ impl Add, Deg> for Deg { #[inline] fn add(self, other impl Sub, Rad> for Rad { #[inline] fn sub(self, other: Rad) -> Rad { rad(self.s - other.s) } } impl Sub, Deg> for Deg { #[inline] fn sub(self, other: Deg) -> Deg { deg(self.s - other.s) } } -impl Neg> for Rad { #[inline] fn neg(&self) -> Rad { rad(-self.s) } } -impl Neg> for Deg { #[inline] fn neg(&self) -> Deg { deg(-self.s) } } +impl Neg> for Rad { #[inline] fn neg(self) -> Rad { rad(-self.s) } } +impl Neg> for Deg { #[inline] fn neg(self) -> Deg { deg(-self.s) } } impl Zero for Rad { #[inline] fn zero() -> Rad { rad(zero()) } #[inline] fn is_zero(&self) -> bool { *self == zero() } } impl Zero for Deg { #[inline] fn zero() -> Deg { deg(zero()) } #[inline] fn is_zero(&self) -> bool { *self == zero() } } diff --git a/src/matrix.rs b/src/matrix.rs index ad51891..57d5187 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -377,9 +377,9 @@ impl Sub, Matrix2> for Matrix2 { #[inli impl Sub, Matrix3> for Matrix3 { #[inline] fn sub(self, other: Matrix3) -> Matrix3 { self.sub_m(&other) } } impl Sub, Matrix4> for Matrix4 { #[inline] fn sub(self, other: Matrix4) -> Matrix4 { self.sub_m(&other) } } -impl Neg> for Matrix2 { #[inline] fn neg(&self) -> Matrix2 { Matrix2::from_cols(self[0].neg(), self[1].neg()) } } -impl Neg> for Matrix3 { #[inline] fn neg(&self) -> Matrix3 { Matrix3::from_cols(self[0].neg(), self[1].neg(), self[2].neg()) } } -impl Neg> for Matrix4 { #[inline] fn neg(&self) -> Matrix4 { Matrix4::from_cols(self[0].neg(), self[1].neg(), self[2].neg(), self[3].neg()) } } +impl Neg> for Matrix2 { #[inline] fn neg(self) -> Matrix2 { Matrix2::from_cols(self[0].neg(), self[1].neg()) } } +impl Neg> for Matrix3 { #[inline] fn neg(self) -> Matrix3 { Matrix3::from_cols(self[0].neg(), self[1].neg(), self[2].neg()) } } +impl Neg> for Matrix4 { #[inline] fn neg(self) -> Matrix4 { Matrix4::from_cols(self[0].neg(), self[1].neg(), self[2].neg(), self[3].neg()) } } impl Zero for Matrix2 { #[inline] fn zero() -> Matrix2 { Matrix2::zero() } #[inline] fn is_zero(&self) -> bool{ *self == zero() } } impl Zero for Matrix3 { #[inline] fn zero() -> Matrix3 { Matrix3::zero() } #[inline] fn is_zero(&self) -> bool{ *self == zero() } } diff --git a/src/quaternion.rs b/src/quaternion.rs index b1ed288..ffa29c6 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -358,7 +358,7 @@ impl ToMatrix4 for Quaternion { impl Neg> for Quaternion { #[inline] - fn neg(&self) -> Quaternion { + fn neg(self) -> Quaternion { Quaternion::from_sv(-self.s, -self.v) } } diff --git a/src/vector.rs b/src/vector.rs index 8a135df..0e6757d 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -313,7 +313,7 @@ macro_rules! vec( } impl Neg<$Self> for $Self { - #[inline] fn neg(&self) -> $Self { $Self::new($(-self.$field),+) } + #[inline] fn neg(self) -> $Self { $Self::new($(-self.$field),+) } } impl Mul<$Self, $Self> for $Self {