4 #![deny(absurd_extreme_comparisons)]
5 #![allow(unused, eq_op, no_effect, unnecessary_operation)]
13 //~^ ERROR this comparison involving the minimum or maximum element for this type contains a
14 //~| HELP using u == 0 instead
16 //~^ ERROR this comparison involving
17 //~| HELP using u == Z instead
19 //~^ ERROR this comparison involving
20 //~| HELP comparison is always false
22 //~^ ERROR this comparison involving
23 //~| HELP using Z == u instead
25 //~^ ERROR this comparison involving
26 //~| HELP comparison is always false
28 //~^ ERROR this comparison involving
29 //~| HELP comparison is always false
31 //~^ ERROR this comparison involving
32 //~| HELP using u == std::u32::MAX instead
34 //~^ ERROR this comparison involving
35 //~| HELP comparison is always false
37 //~^ ERROR this comparison involving
38 //~| HELP using std::u32::MAX == u instead
41 //~^ ERROR this comparison involving
42 //~| HELP because 1-1 is the minimum value for this type, this comparison is always false
44 //~^ ERROR this comparison involving
45 //~| HELP consider using u == !0 instead
47 //~^ ERROR this comparison involving
48 //~| HELP consider using u == 12 - 2*6 instead
52 //~^ ERROR this comparison involving
53 //~| HELP comparison is always false
55 //~^ ERROR this comparison involving
56 //~| HELP comparison is always true
58 //~^ ERROR this comparison involving
59 //~| HELP comparison is always false
63 //~^ ERROR this comparison involving
64 //~| HELP using b == true instead
66 //~^ ERROR this comparison involving
67 //~| HELP comparison is always false
71 // this is handled by unit_cmp
72 () < {}; //~WARNING <-comparison of unit values detected.
75 use std::cmp::{Ordering, PartialEq, PartialOrd};
77 #[derive(PartialEq, PartialOrd)]
80 impl PartialEq<u32> for U {
81 fn eq(&self, other: &u32) -> bool {
82 self.eq(&U(*other as u64))
85 impl PartialOrd<u32> for U {
86 fn partial_cmp(&self, other: &u32) -> Option<Ordering> {
87 self.partial_cmp(&U(*other as u64))
91 pub fn foo(val: U) -> bool {