From edc5bb616d958c7e260a144c336d7b15b52f1de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Mon, 24 Jun 2013 21:38:52 +0000 Subject: [PATCH] Removed some useless references. --- src/adaptors/transform.rs | 10 +++++----- src/traits/norm.rs | 6 +++--- src/traits/sub_dot.rs | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index 7c24b801..dedc37ab 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -19,8 +19,8 @@ pub struct Transform impl Transform { #[inline(always)] - pub fn new(mat: &M, trans: &V) -> Transform - { Transform { submat: copy *mat, subtrans: copy *trans } } + pub fn new(mat: M, trans: V) -> Transform + { Transform { submat: mat, subtrans: trans } } } impl Dim for Transform @@ -81,7 +81,7 @@ impl> Translation for Transform #[inline(always)] fn translated(&self, t: &V) -> Transform - { Transform::new(&self.submat, &self.subtrans.translated(t)) } + { Transform::new(copy self.submat, self.subtrans.translated(t)) } #[inline(always)] fn translate(&mut self, t: &V) @@ -101,7 +101,7 @@ Rotation for Transform // FIXME: this does not seem opitmal let delta = One::one::().rotated(rot); - Transform::new(&self.submat.rotated(rot), &delta.rmul(&self.subtrans)) + Transform::new(self.submat.rotated(rot), delta.rmul(&self.subtrans)) } #[inline(always)] @@ -175,5 +175,5 @@ impl Rand for Transform { #[inline(always)] fn rand(rng: &mut R) -> Transform - { Transform::new(&rng.gen(), &rng.gen()) } + { Transform::new(rng.gen(), rng.gen()) } } diff --git a/src/traits/norm.rs b/src/traits/norm.rs index e2bdece0..49ae4cbd 100644 --- a/src/traits/norm.rs +++ b/src/traits/norm.rs @@ -4,17 +4,17 @@ pub trait Norm { /// Computes the norm a an object. - fn norm(&self) -> N; + fn norm(&self) -> N; /** * Computes the squared norm of an object. Usually faster than computing the * norm itself. */ - fn sqnorm(&self) -> N; + fn sqnorm(&self) -> N; /// Gets the normalized version of the argument. fn normalized(&self) -> Self; /// In-place version of `normalized`. - fn normalize(&mut self) -> N; + fn normalize(&mut self) -> N; } diff --git a/src/traits/sub_dot.rs b/src/traits/sub_dot.rs index 884d68f1..89fba981 100644 --- a/src/traits/sub_dot.rs +++ b/src/traits/sub_dot.rs @@ -1,4 +1,6 @@ -pub trait SubDot +use traits::dot::Dot; + +pub trait SubDot : Sub + Dot { /** * Short-cut to compute the projecton of a point on a vector, but without