clippy: fix suspicious_op_assign_impl errors (false positives)

This commit is contained in:
Philippe Renon 2020-10-26 12:44:53 +01:00
parent a2b128c4e4
commit 04ce8b3f6a
4 changed files with 28 additions and 28 deletions

View File

@ -169,7 +169,7 @@ isometry_binop_assign_impl_all!(
MulAssign, mul_assign; MulAssign, mul_assign;
self: Isometry<N, D, R>, rhs: Translation<N, D>; self: Isometry<N, D, R>, rhs: Translation<N, D>;
[val] => *self *= &rhs; [val] => *self *= &rhs;
[ref] => { [ref] => #[allow(clippy::suspicious_op_assign_impl)] {
let shift = self.rotation.transform_vector(&rhs.vector); let shift = self.rotation.transform_vector(&rhs.vector);
self.translation.vector += shift; self.translation.vector += shift;
}; };
@ -192,7 +192,7 @@ isometry_binop_assign_impl_all!(
DivAssign, div_assign; DivAssign, div_assign;
self: Isometry<N, D, R>, rhs: Isometry<N, D, R>; self: Isometry<N, D, R>, rhs: Isometry<N, D, R>;
[val] => *self /= &rhs; [val] => *self /= &rhs;
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Isometry ×= R // Isometry ×= R
@ -210,8 +210,8 @@ md_assign_impl_all!(
(D, U1), (D, D) for D: DimName; (D, U1), (D, D) for D: DimName;
self: Isometry<N, D, Rotation<N, D>>, rhs: Rotation<N, D>; self: Isometry<N, D, Rotation<N, D>>, rhs: Rotation<N, D>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -227,8 +227,8 @@ 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>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -244,8 +244,8 @@ 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>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Isometry × Point // Isometry × Point

View File

@ -192,7 +192,7 @@ similarity_binop_assign_impl_all!(
self: Similarity<N, D, R>, rhs: Similarity<N, D, R>; self: Similarity<N, D, R>, rhs: Similarity<N, D, R>;
[val] => *self /= &rhs; [val] => *self /= &rhs;
// FIXME: don't invert explicitly. // FIXME: don't invert explicitly.
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Similarity ×= Isometry // Similarity ×= Isometry
@ -213,7 +213,7 @@ similarity_binop_assign_impl_all!(
self: Similarity<N, D, R>, rhs: Isometry<N, D, R>; self: Similarity<N, D, R>, rhs: Isometry<N, D, R>;
[val] => *self /= &rhs; [val] => *self /= &rhs;
// FIXME: don't invert explicitly. // FIXME: don't invert explicitly.
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Similarity ×= R // Similarity ×= R
@ -231,8 +231,8 @@ md_assign_impl_all!(
(D, U1), (D, D) for D: DimName; (D, U1), (D, D) for D: DimName;
self: Similarity<N, D, Rotation<N, D>>, rhs: Rotation<N, D>; self: Similarity<N, D, Rotation<N, D>>, rhs: Rotation<N, D>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -248,8 +248,8 @@ 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>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
md_assign_impl_all!( md_assign_impl_all!(
@ -265,8 +265,8 @@ 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>;
// FIXME: don't invert explicitly? // FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Similarity × Isometry // Similarity × Isometry

View File

@ -491,8 +491,8 @@ md_assign_impl_all!(
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>) (DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>)
for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>; for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>;
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>; self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.clone().inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.clone().inverse() };
); );
// // Transform ÷= Similarity // // Transform ÷= Similarity
@ -521,8 +521,8 @@ md_assign_impl_all!(
DivAssign, div_assign where N: RealField; DivAssign, div_assign where N: RealField;
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory; (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory;
self: Transform<N, D, C>, rhs: Translation<N, D>; self: Transform<N, D, C>, rhs: Translation<N, D>;
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Transform ÷= Rotation // Transform ÷= Rotation
@ -530,8 +530,8 @@ md_assign_impl_all!(
DivAssign, div_assign where N: RealField; DivAssign, div_assign where N: RealField;
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategory; (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategory;
self: Transform<N, D, C>, rhs: Rotation<N, D>; self: Transform<N, D, C>, rhs: Rotation<N, D>;
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );
// Transform ÷= UnitQuaternion // Transform ÷= UnitQuaternion
@ -539,6 +539,6 @@ md_assign_impl_all!(
DivAssign, div_assign where N: RealField; DivAssign, div_assign where N: RealField;
(U4, U4), (U4, U1) for C: TCategory; (U4, U4), (U4, U1) for C: TCategory;
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>; self: Transform<N, U3, C>, rhs: UnitQuaternion<N>;
[val] => *self *= rhs.inverse(); [val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => *self *= rhs.inverse(); [ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
); );

View File

@ -88,21 +88,21 @@ add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd; add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
(D, U1), (D, U1) for D: DimName; (D, U1), (D, U1) for D: DimName;
self: Translation<N, D>, right: &'b Translation<N, D>; self: Translation<N, D>, right: &'b Translation<N, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector += &right.vector }; #[allow(clippy::suspicious_op_assign_impl)] { self.vector += &right.vector };
'b); 'b);
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd; add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
(D, U1), (D, U1) for D: DimName; (D, U1), (D, U1) for D: DimName;
self: Translation<N, D>, right: Translation<N, D>; self: Translation<N, D>, right: Translation<N, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector += right.vector }; ); #[allow(clippy::suspicious_op_assign_impl)] { self.vector += right.vector }; );
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
(D, U1), (D, U1) for D: DimName; (D, U1), (D, U1) for D: DimName;
self: Translation<N, D>, right: &'b Translation<N, D>; self: Translation<N, D>, right: &'b Translation<N, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector -= &right.vector }; #[allow(clippy::suspicious_op_assign_impl)] { self.vector -= &right.vector };
'b); 'b);
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
(D, U1), (D, U1) for D: DimName; (D, U1), (D, U1) for D: DimName;
self: Translation<N, D>, right: Translation<N, D>; self: Translation<N, D>, right: Translation<N, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector -= right.vector }; ); #[allow(clippy::suspicious_op_assign_impl)] { self.vector -= right.vector }; );