diff --git a/src/geometry/isometry_conversion.rs b/src/geometry/isometry_conversion.rs index bdb128f9..e3416cac 100644 --- a/src/geometry/isometry_conversion.rs +++ b/src/geometry/isometry_conversion.rs @@ -187,7 +187,7 @@ where #[inline] fn from(arr: [Isometry; 2]) -> Self { let tra = Translation::from([arr[0].translation.clone(), arr[1].translation.clone()]); - let rot = R::from([arr[0].rotation.clone(), arr[0].rotation.clone()]); + let rot = R::from([arr[0].rotation, arr[0].rotation]); Self::from_parts(tra, rot) } @@ -212,10 +212,10 @@ where arr[3].translation.clone(), ]); let rot = R::from([ - arr[0].rotation.clone(), - arr[1].rotation.clone(), - arr[2].rotation.clone(), - arr[3].rotation.clone(), + arr[0].rotation, + arr[1].rotation, + arr[2].rotation, + arr[3].rotation, ]); Self::from_parts(tra, rot) @@ -245,14 +245,14 @@ where arr[7].translation.clone(), ]); let rot = R::from([ - arr[0].rotation.clone(), - arr[1].rotation.clone(), - arr[2].rotation.clone(), - arr[3].rotation.clone(), - arr[4].rotation.clone(), - arr[5].rotation.clone(), - arr[6].rotation.clone(), - arr[7].rotation.clone(), + arr[0].rotation, + arr[1].rotation, + arr[2].rotation, + arr[3].rotation, + arr[4].rotation, + arr[5].rotation, + arr[6].rotation, + arr[7].rotation, ]); Self::from_parts(tra, rot) @@ -290,22 +290,22 @@ where arr[15].translation.clone(), ]); let rot = R::from([ - arr[0].rotation.clone(), - arr[1].rotation.clone(), - arr[2].rotation.clone(), - arr[3].rotation.clone(), - arr[4].rotation.clone(), - arr[5].rotation.clone(), - arr[6].rotation.clone(), - arr[7].rotation.clone(), - arr[8].rotation.clone(), - arr[9].rotation.clone(), - arr[10].rotation.clone(), - arr[11].rotation.clone(), - arr[12].rotation.clone(), - arr[13].rotation.clone(), - arr[14].rotation.clone(), - arr[15].rotation.clone(), + arr[0].rotation, + arr[1].rotation, + arr[2].rotation, + arr[3].rotation, + arr[4].rotation, + arr[5].rotation, + arr[6].rotation, + arr[7].rotation, + arr[8].rotation, + arr[9].rotation, + arr[10].rotation, + arr[11].rotation, + arr[12].rotation, + arr[13].rotation, + arr[14].rotation, + arr[15].rotation, ]); Self::from_parts(tra, rot) diff --git a/src/geometry/isometry_ops.rs b/src/geometry/isometry_ops.rs index 20e96f3e..ecca9bb2 100644 --- a/src/geometry/isometry_ops.rs +++ b/src/geometry/isometry_ops.rs @@ -219,7 +219,7 @@ md_assign_impl_all!( (U3, U3), (U3, U3) for; self: Isometry>, rhs: UnitQuaternion; [val] => self.rotation *= rhs; - [ref] => self.rotation *= rhs.clone(); + [ref] => self.rotation *= *rhs; ); md_assign_impl_all!( @@ -236,7 +236,7 @@ md_assign_impl_all!( (U2, U2), (U2, U2) for; self: Isometry>, rhs: UnitComplex; [val] => self.rotation *= rhs; - [ref] => self.rotation *= rhs.clone(); + [ref] => self.rotation *= *rhs; ); md_assign_impl_all!( @@ -378,9 +378,9 @@ isometry_from_composition_impl_all!( self: UnitQuaternion, right: Translation, Output = Isometry>; [val val] => Isometry::from_parts(Translation::from(&self * right.vector), self); - [ref val] => Isometry::from_parts(Translation::from( self * right.vector), self.clone()); + [ref val] => Isometry::from_parts(Translation::from( self * right.vector), *self); [val ref] => Isometry::from_parts(Translation::from(&self * &right.vector), self); - [ref ref] => Isometry::from_parts(Translation::from( self * &right.vector), self.clone()); + [ref ref] => Isometry::from_parts(Translation::from( self * &right.vector), *self); ); // Isometry × Rotation @@ -442,9 +442,9 @@ isometry_from_composition_impl_all!( self: Isometry>, rhs: UnitQuaternion, Output = Isometry>; [val val] => Isometry::from_parts(self.translation, self.rotation * rhs); - [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs); // TODO: do not clone. - [val ref] => Isometry::from_parts(self.translation, self.rotation * rhs.clone()); - [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs.clone()); + [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation * rhs); // TODO: do not clone. + [val ref] => Isometry::from_parts(self.translation, self.rotation * *rhs); + [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation * *rhs); ); // UnitQuaternion × Isometry @@ -469,9 +469,9 @@ isometry_from_composition_impl_all!( self: Isometry>, rhs: UnitQuaternion, Output = Isometry>; [val val] => Isometry::from_parts(self.translation, self.rotation / rhs); - [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs); // TODO: do not clone. - [val ref] => Isometry::from_parts(self.translation, self.rotation / rhs.clone()); - [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs.clone()); + [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation / rhs); // TODO: do not clone. + [val ref] => Isometry::from_parts(self.translation, self.rotation / *rhs); + [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation / *rhs); ); // UnitQuaternion ÷ Isometry @@ -505,8 +505,8 @@ isometry_from_composition_impl_all!( self: Translation, right: UnitQuaternion, Output = Isometry>; [val val] => Isometry::from_parts(self, right); [ref val] => Isometry::from_parts(self.clone(), right); - [val ref] => Isometry::from_parts(self, right.clone()); - [ref ref] => Isometry::from_parts(self.clone(), right.clone()); + [val ref] => Isometry::from_parts(self, *right); + [ref ref] => Isometry::from_parts(self.clone(), *right); ); // Isometry × UnitComplex @@ -516,9 +516,9 @@ isometry_from_composition_impl_all!( self: Isometry>, rhs: UnitComplex, Output = Isometry>; [val val] => Isometry::from_parts(self.translation, self.rotation * rhs); - [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs); // TODO: do not clone. - [val ref] => Isometry::from_parts(self.translation, self.rotation * rhs.clone()); - [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs.clone()); + [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation * rhs); // TODO: do not clone. + [val ref] => Isometry::from_parts(self.translation, self.rotation * *rhs); + [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation * *rhs); ); // Isometry ÷ UnitComplex @@ -528,7 +528,7 @@ isometry_from_composition_impl_all!( self: Isometry>, rhs: UnitComplex, Output = Isometry>; [val val] => Isometry::from_parts(self.translation, self.rotation / rhs); - [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs); // TODO: do not clone. - [val ref] => Isometry::from_parts(self.translation, self.rotation / rhs.clone()); - [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs.clone()); + [ref val] => Isometry::from_parts(self.translation.clone(), self.rotation / rhs); // TODO: do not clone. + [val ref] => Isometry::from_parts(self.translation, self.rotation / *rhs); + [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation / *rhs); ); diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index 9840f271..bd1e73c7 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -26,7 +26,7 @@ impl Copy for Orthographic3 {} impl Clone for Orthographic3 { #[inline] fn clone(&self) -> Self { - Self::from_matrix_unchecked(self.matrix.clone()) + Self::from_matrix_unchecked(self.matrix) } } diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index c11b7632..bd8abac2 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -27,7 +27,7 @@ impl Copy for Perspective3 {} impl Clone for Perspective3 { #[inline] fn clone(&self) -> Self { - Self::from_matrix_unchecked(self.matrix.clone()) + Self::from_matrix_unchecked(self.matrix) } } diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 3d2e6d0d..e860a8b8 100755 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -335,7 +335,7 @@ where where N: RealField, { - let mut res = self.clone(); + let mut res = *self; if res.try_inverse_mut() { Some(res) diff --git a/src/geometry/similarity_ops.rs b/src/geometry/similarity_ops.rs index 959ac3a3..319d8647 100644 --- a/src/geometry/similarity_ops.rs +++ b/src/geometry/similarity_ops.rs @@ -240,7 +240,7 @@ md_assign_impl_all!( (U3, U3), (U3, U3) for; self: Similarity>, rhs: UnitQuaternion; [val] => self.isometry.rotation *= rhs; - [ref] => self.isometry.rotation *= rhs.clone(); + [ref] => self.isometry.rotation *= *rhs; ); md_assign_impl_all!( @@ -257,7 +257,7 @@ md_assign_impl_all!( (U2, U2), (U2, U2) for; self: Similarity>, rhs: UnitComplex; [val] => self.isometry.rotation *= rhs; - [ref] => self.isometry.rotation *= rhs.clone(); + [ref] => self.isometry.rotation *= *rhs; ); md_assign_impl_all!( diff --git a/src/geometry/unit_complex_ops.rs b/src/geometry/unit_complex_ops.rs index af1a32f1..ef227023 100644 --- a/src/geometry/unit_complex_ops.rs +++ b/src/geometry/unit_complex_ops.rs @@ -306,9 +306,9 @@ complex_op_impl_all!( self: UnitComplex, rhs: Translation, Output = Isometry>; [val val] => Isometry::from_parts(Translation::from(&self * rhs.vector), self); - [ref val] => Isometry::from_parts(Translation::from( self * rhs.vector), self.clone()); + [ref val] => Isometry::from_parts(Translation::from( self * rhs.vector), *self); [val ref] => Isometry::from_parts(Translation::from(&self * &rhs.vector), self); - [ref ref] => Isometry::from_parts(Translation::from( self * &rhs.vector), self.clone()); + [ref ref] => Isometry::from_parts(Translation::from( self * &rhs.vector), *self); ); // Translation × UnitComplex @@ -319,8 +319,8 @@ complex_op_impl_all!( Output = Isometry>; [val val] => Isometry::from_parts(self, right); [ref val] => Isometry::from_parts(self.clone(), right); - [val ref] => Isometry::from_parts(self, right.clone()); - [ref ref] => Isometry::from_parts(self.clone(), right.clone()); + [val ref] => Isometry::from_parts(self, *right); + [ref ref] => Isometry::from_parts(self.clone(), *right); ); // UnitComplex ×= UnitComplex diff --git a/src/linalg/inverse.rs b/src/linalg/inverse.rs index 79d64121..2cb10351 100644 --- a/src/linalg/inverse.rs +++ b/src/linalg/inverse.rs @@ -40,7 +40,7 @@ impl> SquareMatrix { match dim { 0 => true, 1 => { - let determinant = self.get_unchecked((0, 0)).clone(); + let determinant = *self.get_unchecked((0, 0)); if determinant.is_zero() { false } else {