RS.CLIPPY.SUSPICIOUS_ARITHMETIC_IMPL

Suspicious use of operators in impl of arithmetic 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_arithmetic_impl. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Lints for suspicious operations in impls of arithmetic operators, e.g. subtracting elements in an Add impl.

Why is this bad?

This is probably a typo or copy-and-paste error and not intended.

Example

impl Add for Foo {
    type Output = Foo;

    fn add(self, other: Foo) -> Foo {
        Foo(self.0 - other.0)
    }
}