RS.CLIPPY.SUSPICIOUS_OP_ASSIGN_IMPL
Suspicious use of operators in impl of OpAssign trait
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: suspicious_op_assign_impl. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Lints for suspicious operations in impls of OpAssign, e.g. subtracting elements in an AddAssign impl.
Why is this bad?
This is probably a typo or copy-and-paste error and not intended.
Example
impl AddAssign for Foo {
fn add_assign(&mut self, other: Foo) {
*self = *self - other;
}
}