From a90c2c23fa64714e0e44d2bf805b51f32e3b0d4e Mon Sep 17 00:00:00 2001 From: Dimitri Sabadie Date: Fri, 26 Aug 2016 10:06:10 +0200 Subject: [PATCH] Fixed #198. --- src/structs/dmatrix_macros.rs | 8 ++++---- src/structs/isometry_macros.rs | 8 ++++---- src/structs/matrix_macros.rs | 8 ++++---- src/structs/quaternion.rs | 8 ++++---- src/structs/rotation_macros.rs | 8 ++++---- src/structs/similarity_macros.rs | 8 ++++---- src/structs/vector_macros.rs | 8 ++++---- src/structs/vectorn_macros.rs | 8 ++++---- src/traits/operations.rs | 30 +++++++++++++++--------------- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/structs/dmatrix_macros.rs b/src/structs/dmatrix_macros.rs index 80e99761..346d40f2 100644 --- a/src/structs/dmatrix_macros.rs +++ b/src/structs/dmatrix_macros.rs @@ -873,13 +873,13 @@ macro_rules! dmat_impl( impl> ApproxEq for $dmatrix { #[inline] - fn approx_epsilon(_: Option<$dmatrix>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$dmatrix>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/isometry_macros.rs b/src/structs/isometry_macros.rs index 14cfb5fd..6000c01a 100644 --- a/src/structs/isometry_macros.rs +++ b/src/structs/isometry_macros.rs @@ -378,13 +378,13 @@ macro_rules! isometry_impl( */ impl> ApproxEq for $t { #[inline] - fn approx_epsilon(_: Option<$t>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$t>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/matrix_macros.rs b/src/structs/matrix_macros.rs index acfeb2cf..4f3d12ee 100644 --- a/src/structs/matrix_macros.rs +++ b/src/structs/matrix_macros.rs @@ -277,13 +277,13 @@ macro_rules! matrix_impl( */ impl> ApproxEq for $t { #[inline] - fn approx_epsilon(_: Option<$t>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$t>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/quaternion.rs b/src/structs/quaternion.rs index 3d96e51a..1656e13c 100644 --- a/src/structs/quaternion.rs +++ b/src/structs/quaternion.rs @@ -389,13 +389,13 @@ impl Rand for UnitQuaternion { impl> ApproxEq for UnitQuaternion { #[inline] - fn approx_epsilon(_: Option>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/rotation_macros.rs b/src/structs/rotation_macros.rs index dfcdd835..02981503 100644 --- a/src/structs/rotation_macros.rs +++ b/src/structs/rotation_macros.rs @@ -341,13 +341,13 @@ macro_rules! rotation_impl( */ impl> ApproxEq for $t { #[inline] - fn approx_epsilon(_: Option<$t>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$t>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/similarity_macros.rs b/src/structs/similarity_macros.rs index 73e8aaf7..85903d97 100644 --- a/src/structs/similarity_macros.rs +++ b/src/structs/similarity_macros.rs @@ -353,13 +353,13 @@ macro_rules! similarity_impl( */ impl> ApproxEq for $t { #[inline] - fn approx_epsilon(_: Option<$t>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$t>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/vector_macros.rs b/src/structs/vector_macros.rs index 7bd0e931..22987910 100644 --- a/src/structs/vector_macros.rs +++ b/src/structs/vector_macros.rs @@ -34,13 +34,13 @@ macro_rules! vectorlike_impl( */ impl> ApproxEq for $t { #[inline] - fn approx_epsilon(_: Option<$t>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$t>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/structs/vectorn_macros.rs b/src/structs/vectorn_macros.rs index 74749375..05046c1a 100644 --- a/src/structs/vectorn_macros.rs +++ b/src/structs/vectorn_macros.rs @@ -582,13 +582,13 @@ macro_rules! vecn_dvec_common_impl( */ impl $(, $param : ArrayLength)*> ApproxEq for $vecn { #[inline] - fn approx_epsilon(_: Option<$vecn>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } #[inline] - fn approx_ulps(_: Option<$vecn>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } #[inline] diff --git a/src/traits/operations.rs b/src/traits/operations.rs index 7059e30e..8a7a7066 100644 --- a/src/traits/operations.rs +++ b/src/traits/operations.rs @@ -152,13 +152,13 @@ pub trait PartialOrder { /// Trait for testing approximate equality pub trait ApproxEq: Sized { /// Default epsilon for approximation. - fn approx_epsilon(unused_mut: Option) -> Eps; + fn approx_epsilon() -> Eps; /// Tests approximate equality using a custom epsilon. fn approx_eq_eps(&self, other: &Self, epsilon: &Eps) -> bool; /// Default ULPs for approximation. - fn approx_ulps(unused_mut: Option) -> u32; + fn approx_ulps() -> u32; /// Tests approximate equality using units in the last place (ULPs) fn approx_eq_ulps(&self, other: &Self, ulps: u32) -> bool; @@ -166,13 +166,13 @@ pub trait ApproxEq: Sized { /// Tests approximate equality. #[inline] fn approx_eq(&self, other: &Self) -> bool { - self.approx_eq_eps(other, &ApproxEq::approx_epsilon(None::)) + self.approx_eq_eps(other, &Self::approx_epsilon()) } } impl ApproxEq for f32 { #[inline] - fn approx_epsilon(_: Option) -> f32 { + fn approx_epsilon() -> f32 { 1.0e-6 } @@ -181,7 +181,7 @@ impl ApproxEq for f32 { ::abs(&(*self - *other)) < *epsilon } - fn approx_ulps(_: Option) -> u32 { + fn approx_ulps() -> u32 { 8 } @@ -203,7 +203,7 @@ impl ApproxEq for f32 { impl ApproxEq for f64 { #[inline] - fn approx_epsilon(_: Option) -> f64 { + fn approx_epsilon() -> f64 { 1.0e-6 } @@ -212,7 +212,7 @@ impl ApproxEq for f64 { ::abs(&(*self - *other)) < *approx_epsilon } - fn approx_ulps(_: Option) -> u32 { + fn approx_ulps() -> u32 { 8 } @@ -231,16 +231,16 @@ impl ApproxEq for f64 { } impl<'a, N, T: ApproxEq> ApproxEq for &'a T { - fn approx_epsilon(_: Option<&'a T>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } fn approx_eq_eps(&self, other: &&'a T, approx_epsilon: &N) -> bool { ApproxEq::approx_eq_eps(*self, *other, approx_epsilon) } - fn approx_ulps(_: Option<&'a T>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } fn approx_eq_ulps(&self, other: &&'a T, ulps: u32) -> bool { @@ -249,16 +249,16 @@ impl<'a, N, T: ApproxEq> ApproxEq for &'a T { } impl<'a, N, T: ApproxEq> ApproxEq for &'a mut T { - fn approx_epsilon(_: Option<&'a mut T>) -> N { - ApproxEq::approx_epsilon(None::) + fn approx_epsilon() -> N { + >::approx_epsilon() } fn approx_eq_eps(&self, other: &&'a mut T, approx_epsilon: &N) -> bool { ApproxEq::approx_eq_eps(*self, *other, approx_epsilon) } - fn approx_ulps(_: Option<&'a mut T>) -> u32 { - ApproxEq::approx_ulps(None::) + fn approx_ulps() -> u32 { + >::approx_ulps() } fn approx_eq_ulps(&self, other: &&'a mut T, ulps: u32) -> bool {