Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy: fix suspicious_op_assign_impl errors (false positives) #783

Merged
merged 1 commit into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 }; );