clippy: fix clone_on_copy warnings

This commit is contained in:
Philippe Renon 2020-11-19 12:55:15 +01:00
parent bbc6a28f7d
commit 87ee014bd3
8 changed files with 57 additions and 57 deletions

View File

@ -187,7 +187,7 @@ where
#[inline] #[inline]
fn from(arr: [Isometry<N::Element, D, R::Element>; 2]) -> Self { fn from(arr: [Isometry<N::Element, D, R::Element>; 2]) -> Self {
let tra = Translation::from([arr[0].translation.clone(), arr[1].translation.clone()]); 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) Self::from_parts(tra, rot)
} }
@ -212,10 +212,10 @@ where
arr[3].translation.clone(), arr[3].translation.clone(),
]); ]);
let rot = R::from([ let rot = R::from([
arr[0].rotation.clone(), arr[0].rotation,
arr[1].rotation.clone(), arr[1].rotation,
arr[2].rotation.clone(), arr[2].rotation,
arr[3].rotation.clone(), arr[3].rotation,
]); ]);
Self::from_parts(tra, rot) Self::from_parts(tra, rot)
@ -245,14 +245,14 @@ where
arr[7].translation.clone(), arr[7].translation.clone(),
]); ]);
let rot = R::from([ let rot = R::from([
arr[0].rotation.clone(), arr[0].rotation,
arr[1].rotation.clone(), arr[1].rotation,
arr[2].rotation.clone(), arr[2].rotation,
arr[3].rotation.clone(), arr[3].rotation,
arr[4].rotation.clone(), arr[4].rotation,
arr[5].rotation.clone(), arr[5].rotation,
arr[6].rotation.clone(), arr[6].rotation,
arr[7].rotation.clone(), arr[7].rotation,
]); ]);
Self::from_parts(tra, rot) Self::from_parts(tra, rot)
@ -290,22 +290,22 @@ where
arr[15].translation.clone(), arr[15].translation.clone(),
]); ]);
let rot = R::from([ let rot = R::from([
arr[0].rotation.clone(), arr[0].rotation,
arr[1].rotation.clone(), arr[1].rotation,
arr[2].rotation.clone(), arr[2].rotation,
arr[3].rotation.clone(), arr[3].rotation,
arr[4].rotation.clone(), arr[4].rotation,
arr[5].rotation.clone(), arr[5].rotation,
arr[6].rotation.clone(), arr[6].rotation,
arr[7].rotation.clone(), arr[7].rotation,
arr[8].rotation.clone(), arr[8].rotation,
arr[9].rotation.clone(), arr[9].rotation,
arr[10].rotation.clone(), arr[10].rotation,
arr[11].rotation.clone(), arr[11].rotation,
arr[12].rotation.clone(), arr[12].rotation,
arr[13].rotation.clone(), arr[13].rotation,
arr[14].rotation.clone(), arr[14].rotation,
arr[15].rotation.clone(), arr[15].rotation,
]); ]);
Self::from_parts(tra, rot) Self::from_parts(tra, rot)

View File

@ -219,7 +219,7 @@ md_assign_impl_all!(
(U3, U3), (U3, U3) for; (U3, U3), (U3, U3) for;
self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>; self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>;
[val] => self.rotation *= rhs; [val] => self.rotation *= rhs;
[ref] => self.rotation *= rhs.clone(); [ref] => self.rotation *= *rhs;
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -236,7 +236,7 @@ md_assign_impl_all!(
(U2, U2), (U2, U2) for; (U2, U2), (U2, U2) for;
self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>; self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>;
[val] => self.rotation *= rhs; [val] => self.rotation *= rhs;
[ref] => self.rotation *= rhs.clone(); [ref] => self.rotation *= *rhs;
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -378,9 +378,9 @@ isometry_from_composition_impl_all!(
self: UnitQuaternion<N>, right: Translation<N, U3>, self: UnitQuaternion<N>, right: Translation<N, U3>,
Output = Isometry<N, U3, UnitQuaternion<N>>; Output = Isometry<N, U3, UnitQuaternion<N>>;
[val val] => Isometry::from_parts(Translation::from(&self * right.vector), self); [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); [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 // Isometry × Rotation
@ -442,9 +442,9 @@ isometry_from_composition_impl_all!(
self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>, self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>,
Output = Isometry<N, U3, UnitQuaternion<N>>; Output = Isometry<N, U3, UnitQuaternion<N>>;
[val val] => Isometry::from_parts(self.translation, self.rotation * rhs); [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. [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.clone()); [val ref] => Isometry::from_parts(self.translation, self.rotation * *rhs);
[ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs.clone()); [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation * *rhs);
); );
// UnitQuaternion × Isometry // UnitQuaternion × Isometry
@ -469,9 +469,9 @@ isometry_from_composition_impl_all!(
self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>, self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>,
Output = Isometry<N, U3, UnitQuaternion<N>>; Output = Isometry<N, U3, UnitQuaternion<N>>;
[val val] => Isometry::from_parts(self.translation, self.rotation / rhs); [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. [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.clone()); [val ref] => Isometry::from_parts(self.translation, self.rotation / *rhs);
[ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs.clone()); [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation / *rhs);
); );
// UnitQuaternion ÷ Isometry // UnitQuaternion ÷ Isometry
@ -505,8 +505,8 @@ isometry_from_composition_impl_all!(
self: Translation<N, U3>, right: UnitQuaternion<N>, Output = Isometry<N, U3, UnitQuaternion<N>>; self: Translation<N, U3>, right: UnitQuaternion<N>, Output = Isometry<N, U3, UnitQuaternion<N>>;
[val val] => Isometry::from_parts(self, right); [val val] => Isometry::from_parts(self, right);
[ref val] => Isometry::from_parts(self.clone(), right); [ref val] => Isometry::from_parts(self.clone(), right);
[val ref] => Isometry::from_parts(self, right.clone()); [val ref] => Isometry::from_parts(self, *right);
[ref ref] => Isometry::from_parts(self.clone(), right.clone()); [ref ref] => Isometry::from_parts(self.clone(), *right);
); );
// Isometry × UnitComplex // Isometry × UnitComplex
@ -516,9 +516,9 @@ isometry_from_composition_impl_all!(
self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>, self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>,
Output = Isometry<N, U2, UnitComplex<N>>; Output = Isometry<N, U2, UnitComplex<N>>;
[val val] => Isometry::from_parts(self.translation, self.rotation * rhs); [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. [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.clone()); [val ref] => Isometry::from_parts(self.translation, self.rotation * *rhs);
[ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() * rhs.clone()); [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation * *rhs);
); );
// Isometry ÷ UnitComplex // Isometry ÷ UnitComplex
@ -528,7 +528,7 @@ isometry_from_composition_impl_all!(
self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>, self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>,
Output = Isometry<N, U2, UnitComplex<N>>; Output = Isometry<N, U2, UnitComplex<N>>;
[val val] => Isometry::from_parts(self.translation, self.rotation / rhs); [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. [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.clone()); [val ref] => Isometry::from_parts(self.translation, self.rotation / *rhs);
[ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation.clone() / rhs.clone()); [ref ref] => Isometry::from_parts(self.translation.clone(), self.rotation / *rhs);
); );

View File

@ -26,7 +26,7 @@ impl<N: RealField> Copy for Orthographic3<N> {}
impl<N: RealField> Clone for Orthographic3<N> { impl<N: RealField> Clone for Orthographic3<N> {
#[inline] #[inline]
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self::from_matrix_unchecked(self.matrix.clone()) Self::from_matrix_unchecked(self.matrix)
} }
} }

View File

@ -27,7 +27,7 @@ impl<N: RealField> Copy for Perspective3<N> {}
impl<N: RealField> Clone for Perspective3<N> { impl<N: RealField> Clone for Perspective3<N> {
#[inline] #[inline]
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self::from_matrix_unchecked(self.matrix.clone()) Self::from_matrix_unchecked(self.matrix)
} }
} }

View File

@ -335,7 +335,7 @@ where
where where
N: RealField, N: RealField,
{ {
let mut res = self.clone(); let mut res = *self;
if res.try_inverse_mut() { if res.try_inverse_mut() {
Some(res) Some(res)

View File

@ -240,7 +240,7 @@ md_assign_impl_all!(
(U3, U3), (U3, U3) for; (U3, U3), (U3, U3) for;
self: Similarity<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>; self: Similarity<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>;
[val] => self.isometry.rotation *= rhs; [val] => self.isometry.rotation *= rhs;
[ref] => self.isometry.rotation *= rhs.clone(); [ref] => self.isometry.rotation *= *rhs;
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -257,7 +257,7 @@ md_assign_impl_all!(
(U2, U2), (U2, U2) for; (U2, U2), (U2, U2) for;
self: Similarity<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>; self: Similarity<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>;
[val] => self.isometry.rotation *= rhs; [val] => self.isometry.rotation *= rhs;
[ref] => self.isometry.rotation *= rhs.clone(); [ref] => self.isometry.rotation *= *rhs;
); );
md_assign_impl_all!( md_assign_impl_all!(

View File

@ -306,9 +306,9 @@ complex_op_impl_all!(
self: UnitComplex<N>, rhs: Translation<N, U2>, self: UnitComplex<N>, rhs: Translation<N, U2>,
Output = Isometry<N, U2, UnitComplex<N>>; Output = Isometry<N, U2, UnitComplex<N>>;
[val val] => Isometry::from_parts(Translation::from(&self * rhs.vector), self); [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); [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 // Translation × UnitComplex
@ -319,8 +319,8 @@ complex_op_impl_all!(
Output = Isometry<N, U2, UnitComplex<N>>; Output = Isometry<N, U2, UnitComplex<N>>;
[val val] => Isometry::from_parts(self, right); [val val] => Isometry::from_parts(self, right);
[ref val] => Isometry::from_parts(self.clone(), right); [ref val] => Isometry::from_parts(self.clone(), right);
[val ref] => Isometry::from_parts(self, right.clone()); [val ref] => Isometry::from_parts(self, *right);
[ref ref] => Isometry::from_parts(self.clone(), right.clone()); [ref ref] => Isometry::from_parts(self.clone(), *right);
); );
// UnitComplex ×= UnitComplex // UnitComplex ×= UnitComplex

View File

@ -40,7 +40,7 @@ impl<N: ComplexField, D: Dim, S: StorageMut<N, D, D>> SquareMatrix<N, D, S> {
match dim { match dim {
0 => true, 0 => true,
1 => { 1 => {
let determinant = self.get_unchecked((0, 0)).clone(); let determinant = *self.get_unchecked((0, 0));
if determinant.is_zero() { if determinant.is_zero() {
false false
} else { } else {