2017-02-17 02:32:51 -06:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
2017-02-19 21:50:31 -06:00
|
|
|
#![allow(needless_pass_by_value)]
|
2017-05-17 07:19:44 -05:00
|
|
|
#![warn(should_assert_eq)]
|
2017-02-17 02:32:51 -06:00
|
|
|
|
|
|
|
#[derive(PartialEq, Eq)]
|
|
|
|
struct NonDebug(i32);
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Eq)]
|
|
|
|
struct Debug(i32);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert!(1 == 2);
|
|
|
|
assert!(Debug(1) == Debug(2));
|
|
|
|
assert!(NonDebug(1) == NonDebug(1)); // ok
|
2017-02-22 01:47:18 -06:00
|
|
|
assert!(Debug(1) != Debug(2));
|
|
|
|
assert!(NonDebug(1) != NonDebug(2)); // ok
|
2017-02-17 04:59:52 -06:00
|
|
|
|
|
|
|
test_generic(1, 2, 3, 4);
|
2017-05-15 15:49:20 -05:00
|
|
|
|
|
|
|
debug_assert!(4 == 5);
|
|
|
|
debug_assert!(4 != 6);
|
2017-02-17 04:59:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_generic<T: std::fmt::Debug + Eq, U: Eq>(x: T, y: T, z: U, w: U) {
|
|
|
|
assert!(x == y);
|
|
|
|
assert!(z == w); // ok
|
2017-02-22 01:47:18 -06:00
|
|
|
|
|
|
|
assert!(x != y);
|
|
|
|
assert!(z != w); // ok
|
2017-02-17 02:32:51 -06:00
|
|
|
}
|