From d47cdb55947e272e4eb84846e429969cdd67212a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Apr 2015 18:58:20 -0400 Subject: [PATCH] Remove Neg from BaseNum As per https://github.com/rust-lang/rust/pull/23945, Neg is no longer implemented for unsigned types. Signed-off-by: Anders Kaseorg --- src/structs/iso.rs | 2 +- src/structs/iso_macros.rs | 2 +- src/structs/quat.rs | 12 ++++++------ src/structs/spec/mat.rs | 6 +++--- src/traits/structure.rs | 6 ++---- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/structs/iso.rs b/src/structs/iso.rs index 5d5e6a92..ecff2aab 100644 --- a/src/structs/iso.rs +++ b/src/structs/iso.rs @@ -2,7 +2,7 @@ #![allow(missing_docs)] -use std::ops::{Add, Sub, Mul}; +use std::ops::{Add, Sub, Mul, Neg}; use rand::{Rand, Rng}; use structs::mat::{Mat3, Mat4, Mat5}; diff --git a/src/structs/iso_macros.rs b/src/structs/iso_macros.rs index 6f863583..7cdd3136 100644 --- a/src/structs/iso_macros.rs +++ b/src/structs/iso_macros.rs @@ -278,7 +278,7 @@ macro_rules! transform_impl( macro_rules! inv_impl( ($t: ident) => ( - impl Inv for $t { + impl> Inv for $t { #[inline] fn inv_mut(&mut self) -> bool { self.rotation.inv_mut(); diff --git a/src/structs/quat.rs b/src/structs/quat.rs index 509c42f1..d2b20d65 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -365,7 +365,7 @@ impl Mul> for UnitQuat { } } -impl Mul> for Vec3 { +impl> Mul> for Vec3 { type Output = Vec3; #[inline] @@ -378,7 +378,7 @@ impl Mul> for Vec3 { } } -impl Mul> for Pnt3 { +impl> Mul> for Pnt3 { type Output = Pnt3; #[inline] @@ -433,7 +433,7 @@ impl Rotation> for UnitQuat { } } -impl Rotate> for UnitQuat { +impl> Rotate> for UnitQuat { #[inline] fn rotate(&self, v: &Vec3) -> Vec3 { *self * *v @@ -445,7 +445,7 @@ impl Rotate> for UnitQuat { } } -impl Rotate> for UnitQuat { +impl> Rotate> for UnitQuat { #[inline] fn rotate(&self, p: &Pnt3) -> Pnt3 { *self * *p @@ -457,7 +457,7 @@ impl Rotate> for UnitQuat { } } -impl Transform> for UnitQuat { +impl> Transform> for UnitQuat { #[inline] fn transform(&self, v: &Vec3) -> Vec3 { *self * *v @@ -469,7 +469,7 @@ impl Transform> for UnitQuat { } } -impl Transform> for UnitQuat { +impl> Transform> for UnitQuat { #[inline] fn transform(&self, p: &Pnt3) -> Pnt3 { *self * *p diff --git a/src/structs/spec/mat.rs b/src/structs/spec/mat.rs index 99e35213..d4d80602 100644 --- a/src/structs/spec/mat.rs +++ b/src/structs/spec/mat.rs @@ -1,4 +1,4 @@ -use std::ops::{Add, Mul}; +use std::ops::{Add, Mul, Neg}; use structs::vec::{Vec2, Vec3}; use structs::pnt::{Pnt2, Pnt3}; use structs::mat::{Mat1, Mat2, Mat3}; @@ -32,7 +32,7 @@ impl> Inv for Mat1 { } } -impl> Inv for Mat2 { +impl + ApproxEq> Inv for Mat2 { #[inline] fn inv(&self) -> Option> { let mut res = *self; @@ -61,7 +61,7 @@ impl> Inv for Mat2 { } } -impl> Inv for Mat3 { +impl + ApproxEq> Inv for Mat3 { #[inline] fn inv(&self) -> Option> { let mut res = *self; diff --git a/src/traits/structure.rs b/src/traits/structure.rs index 93b0b4dd..1f66b8a2 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -3,7 +3,7 @@ use std::{f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize}; use std::num::Float; use std::slice::{Iter, IterMut}; -use std::ops::{Add, Sub, Mul, Div, Neg, Rem, Index, IndexMut}; +use std::ops::{Add, Sub, Mul, Div, Rem, Index, IndexMut}; use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute}; use traits::geometry::{Dot, Norm, Orig}; @@ -11,7 +11,7 @@ use traits::geometry::{Dot, Norm, Orig}; pub trait BaseNum: Copy + Zero + One + Add + Sub + Mul + Div + - Rem + Neg + PartialEq + + Rem + PartialEq + Absolute + Axpy { } @@ -239,7 +239,6 @@ pub trait VecAsPnt

{ pub trait NumVec: Dim + Sub + Add + Mul + Div + - Neg + Index + Zero + PartialEq + Dot + Axpy { } @@ -276,7 +275,6 @@ pub trait NumPnt: PartialEq + Axpy + Sub + - Neg + Mul + Div + Add +