Skip to content

Commit

Permalink
Merge pull request #783 from filnet/clippy_fixes
Browse files Browse the repository at this point in the history
clippy: fix suspicious_op_assign_impl errors (false positives)
  • Loading branch information
sebcrozet committed Nov 10, 2020
2 parents 72734e1 + 04ce8b3 commit e2e3cea
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
16 changes: 8 additions & 8 deletions src/geometry/isometry_ops.rs
Expand Up @@ -169,7 +169,7 @@ isometry_binop_assign_impl_all!(
MulAssign, mul_assign;
self: Isometry<N, D, R>, rhs: Translation<N, D>;
[val] => *self *= &rhs;
[ref] => {
[ref] => #[allow(clippy::suspicious_op_assign_impl)] {
let shift = self.rotation.transform_vector(&rhs.vector);
self.translation.vector += shift;
};
Expand All @@ -192,7 +192,7 @@ isometry_binop_assign_impl_all!(
DivAssign, div_assign;
self: Isometry<N, D, R>, rhs: Isometry<N, D, R>;
[val] => *self /= &rhs;
[ref] => *self *= rhs.inverse();
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Isometry ×= R
Expand All @@ -210,8 +210,8 @@ md_assign_impl_all!(
(D, U1), (D, D) for D: DimName;
self: Isometry<N, D, Rotation<N, D>>, rhs: Rotation<N, D>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

md_assign_impl_all!(
Expand All @@ -227,8 +227,8 @@ md_assign_impl_all!(
(U3, U3), (U3, U3) for;
self: Isometry<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

md_assign_impl_all!(
Expand All @@ -244,8 +244,8 @@ md_assign_impl_all!(
(U2, U2), (U2, U2) for;
self: Isometry<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Isometry × Point
Expand Down
16 changes: 8 additions & 8 deletions src/geometry/similarity_ops.rs
Expand Up @@ -192,7 +192,7 @@ similarity_binop_assign_impl_all!(
self: Similarity<N, D, R>, rhs: Similarity<N, D, R>;
[val] => *self /= &rhs;
// FIXME: don't invert explicitly.
[ref] => *self *= rhs.inverse();
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Similarity ×= Isometry
Expand All @@ -213,7 +213,7 @@ similarity_binop_assign_impl_all!(
self: Similarity<N, D, R>, rhs: Isometry<N, D, R>;
[val] => *self /= &rhs;
// FIXME: don't invert explicitly.
[ref] => *self *= rhs.inverse();
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Similarity ×= R
Expand All @@ -231,8 +231,8 @@ md_assign_impl_all!(
(D, U1), (D, D) for D: DimName;
self: Similarity<N, D, Rotation<N, D>>, rhs: Rotation<N, D>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

md_assign_impl_all!(
Expand All @@ -248,8 +248,8 @@ md_assign_impl_all!(
(U3, U3), (U3, U3) for;
self: Similarity<N, U3, UnitQuaternion<N>>, rhs: UnitQuaternion<N>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

md_assign_impl_all!(
Expand All @@ -265,8 +265,8 @@ md_assign_impl_all!(
(U2, U2), (U2, U2) for;
self: Similarity<N, U2, UnitComplex<N>>, rhs: UnitComplex<N>;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Similarity × Isometry
Expand Down
16 changes: 8 additions & 8 deletions src/geometry/transform_ops.rs
Expand Up @@ -491,8 +491,8 @@ md_assign_impl_all!(
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>)
for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>;
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.clone().inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.clone().inverse() };
);

// // Transform ÷= Similarity
Expand Down Expand Up @@ -521,24 +521,24 @@ md_assign_impl_all!(
DivAssign, div_assign where N: RealField;
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory;
self: Transform<N, D, C>, rhs: Translation<N, D>;
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Transform ÷= Rotation
md_assign_impl_all!(
DivAssign, div_assign where N: RealField;
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategory;
self: Transform<N, D, C>, rhs: Rotation<N, D>;
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);

// Transform ÷= UnitQuaternion
md_assign_impl_all!(
DivAssign, div_assign where N: RealField;
(U4, U4), (U4, U1) for C: TCategory;
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>;
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
[ref] => #[allow(clippy::suspicious_op_assign_impl)] { *self *= rhs.inverse() };
);
8 changes: 4 additions & 4 deletions src/geometry/translation_ops.rs
Expand Up @@ -88,21 +88,21 @@ add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
(D, U1), (D, U1) for D: DimName;
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);

add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
(D, U1), (D, U1) for D: DimName;
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;
(D, U1), (D, U1) for D: DimName;
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);

add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
(D, U1), (D, U1) for D: DimName;
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 }; );

0 comments on commit e2e3cea

Please sign in to comment.