2016-07-20 13:29:24 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#[allow(unused_assignments)]
|
2017-05-17 12:19:44 +00:00
|
|
|
#[warn(misrefactored_assign_op)]
|
2016-07-20 13:29:24 +00:00
|
|
|
fn main() {
|
|
|
|
let mut a = 5;
|
2017-02-08 13:58:07 +00:00
|
|
|
a += a + 1;
|
|
|
|
a += 1 + a;
|
|
|
|
a -= a - 1;
|
|
|
|
a *= a * 99;
|
|
|
|
a *= 42 * a;
|
|
|
|
a /= a / 2;
|
|
|
|
a %= a % 5;
|
|
|
|
a &= a & 1;
|
2016-07-20 13:29:24 +00:00
|
|
|
a -= 1 - a;
|
|
|
|
a /= 5 / a;
|
|
|
|
a %= 42 % a;
|
|
|
|
a <<= 6 << a;
|
|
|
|
}
|
2016-12-19 10:13:07 +00:00
|
|
|
|
|
|
|
// check that we don't lint on op assign impls, because that's just the way to impl them
|
|
|
|
|
|
|
|
use std::ops::{Mul, MulAssign};
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
|
|
|
pub struct Wrap(i64);
|
|
|
|
|
|
|
|
impl Mul<i64> for Wrap {
|
|
|
|
type Output = Self;
|
|
|
|
|
|
|
|
fn mul(self, rhs: i64) -> Self {
|
|
|
|
Wrap(self.0 * rhs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MulAssign<i64> for Wrap {
|
|
|
|
fn mul_assign(&mut self, rhs: i64) {
|
|
|
|
*self = *self * rhs
|
|
|
|
}
|
|
|
|
}
|