4 #![warn(suspicious_arithmetic_impl)]
5 use std::ops::{Add, AddAssign, Mul, Sub, Div};
13 fn add(self, other: Self) -> Self {
18 impl AddAssign for Foo {
19 fn add_assign(&mut self, other: Foo) {
20 *self = *self - other;
27 fn mul(self, other: Foo) -> Foo {
28 Foo(self.0 * other.0 % 42) // OK: BiRem part of BiExpr as parent node
35 fn sub(self, other: Self) -> Self {
36 Foo(self.0 * other.0 - 42) // OK: BiMul part of BiExpr as child node
43 fn div(self, other: Self) -> Self {
44 Foo(do_nothing(self.0 + other.0) / 42) // OK: BiAdd part of BiExpr as child node
53 fn add(self, other: Self) -> Self {
54 Bar(self.0 & !other.0) // OK: UnNot part of BiExpr as child node
61 fn sub(self, other: Self) -> Self {
62 if self.0 <= other.0 {
63 Bar(-(self.0 & other.0)) // OK: UnNeg part of BiExpr as parent node
72 fn do_nothing(x: u32) -> u32 {