blob: e8a023ab17643514d08d08c803d51beea762610f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#![warn(clippy::arithmetic_side_effects)]
use core::ops::{Add, Neg};
#[derive(Clone, Copy)]
struct Point {
x: i32,
y: i32,
}
impl Add for Point {
type Output = Self;
fn add(self, other: Self) -> Self {
todo!()
}
}
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;
}
|