]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs
Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup
[rust.git] / src / tools / clippy / tests / ui-toml / arithmetic_side_effects_allowed / arithmetic_side_effects_allowed.rs
1 #![warn(clippy::arithmetic_side_effects)]
2
3 use core::ops::{Add, Neg};
4
5 #[derive(Clone, Copy)]
6 struct Point {
7     x: i32,
8     y: i32,
9 }
10
11 impl Add for Point {
12     type Output = Self;
13
14     fn add(self, other: Self) -> Self {
15         todo!()
16     }
17 }
18
19 impl Neg for Point {
20     type Output = Self;
21
22     fn neg(self) -> Self::Output {
23         todo!()
24     }
25 }
26
27 fn main() {
28     let _ = Point { x: 1, y: 0 } + Point { x: 2, y: 3 };
29
30     let point: Point = Point { x: 1, y: 0 };
31     let _ = point + point;
32     let _ = -point;
33 }