]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui-toml / arithmetic_side_effects_allowed / arithmetic_side_effects_allowed.rs
CommitLineData
f2b60f7d 1#![warn(clippy::arithmetic_side_effects)]
064997fb 2
487cf647 3use core::ops::{Add, Neg};
064997fb
FG
4
5#[derive(Clone, Copy)]
6struct Point {
7 x: i32,
8 y: i32,
9}
10
11impl Add for Point {
12 type Output = Self;
13
14 fn add(self, other: Self) -> Self {
15 todo!()
16 }
17}
18
487cf647
FG
19impl Neg for Point {
20 type Output = Self;
21
22 fn neg(self) -> Self::Output {
23 todo!()
24 }
25}
26
064997fb
FG
27fn 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}