From 4547b622d8d29df964fa2914213088b148c498fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:32 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- .../arithmetic_side_effects_allowed.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed') diff --git a/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs index 1aed09b7c..e8a023ab1 100644 --- a/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs +++ b/src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs @@ -1,6 +1,6 @@ #![warn(clippy::arithmetic_side_effects)] -use core::ops::Add; +use core::ops::{Add, Neg}; #[derive(Clone, Copy)] struct Point { @@ -16,9 +16,18 @@ impl Add for Point { } } +impl Neg for Point { + type Output = Self; + + fn neg(self) -> Self::Output { + 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; + let _ = -point; } -- cgit v1.2.3