]> git.lizzy.rs Git - rust.git/blob - tests/ui/assign_ops2.rs
remove all //~ from tests
[rust.git] / tests / ui / assign_ops2.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #[allow(unused_assignments)]
5 #[deny(misrefactored_assign_op)]
6 fn main() {
7     let mut a = 5;
8     a += a + 1;
9
10
11     a += 1 + a;
12
13
14     a -= a - 1;
15
16
17     a *= a * 99;
18
19
20     a *= 42 * a;
21
22
23     a /= a / 2;
24
25
26     a %= a % 5;
27
28
29     a &= a & 1;
30
31
32     a -= 1 - a;
33     a /= 5 / a;
34     a %= 42 % a;
35     a <<= 6 << a;
36 }
37
38 // check that we don't lint on op assign impls, because that's just the way to impl them
39
40 use std::ops::{Mul, MulAssign};
41
42 #[derive(Copy, Clone, Debug, PartialEq)]
43 pub struct Wrap(i64);
44
45 impl Mul<i64> for Wrap {
46     type Output = Self;
47
48     fn mul(self, rhs: i64) -> Self {
49         Wrap(self.0 * rhs)
50     }
51 }
52
53 impl MulAssign<i64> for Wrap {
54     fn mul_assign(&mut self, rhs: i64) {
55         *self = *self * rhs
56     }
57 }