diff options
Diffstat (limited to 'src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs')
-rw-r--r-- | src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs new file mode 100644 index 000000000..195fabdbf --- /dev/null +++ b/src/tools/clippy/tests/ui-toml/arithmetic_allowed/arithmetic_allowed.rs @@ -0,0 +1,24 @@ +#![warn(clippy::arithmetic)] + +use core::ops::Add; + +#[derive(Clone, Copy)] +struct Point { + x: i32, + y: i32, +} + +impl Add for Point { + type Output = Self; + + fn add(self, other: Self) -> Self { + todo!() + } +} + +fn main() { + let _ = Point { x: 1, y: 0 } + Point { x: 2, y: 3 }; + + let point: Point = Point { x: 1, y: 0 }; + let _ = point + point; +} |