]>
Commit | Line | Data |
---|---|---|
f2b60f7d | 1 | #![warn(clippy::arithmetic_side_effects)] |
064997fb | 2 | |
487cf647 | 3 | use core::ops::{Add, Neg}; |
064997fb FG |
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 | ||
487cf647 FG |
19 | impl Neg for Point { |
20 | type Output = Self; | |
21 | ||
22 | fn neg(self) -> Self::Output { | |
23 | todo!() | |
24 | } | |
25 | } | |
26 | ||
064997fb FG |
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; | |
487cf647 | 32 | let _ = -point; |
064997fb | 33 | } |