@@ -16,44 +16,44 @@ macro_rules! b {
16
16
// Implements the Not trait but with an output type
17
17
// that's not bool. Should not suggest a rewrite
18
18
#[ derive( Debug ) ]
19
- enum A {
19
+ enum ImplNotTraitWithoutBool {
20
20
VariantX ( bool ) ,
21
21
VariantY ( u32 ) ,
22
22
}
23
23
24
- impl PartialEq < bool > for A {
24
+ impl PartialEq < bool > for ImplNotTraitWithoutBool {
25
25
fn eq ( & self , other : & bool ) -> bool {
26
26
match * self {
27
- A :: VariantX ( b) => b == * other,
27
+ ImplNotTraitWithoutBool :: VariantX ( b) => b == * other,
28
28
_ => false ,
29
29
}
30
30
}
31
31
}
32
32
33
- impl Not for A {
33
+ impl Not for ImplNotTraitWithoutBool {
34
34
type Output = Self ;
35
35
36
36
fn not ( self ) -> Self :: Output {
37
37
match self {
38
- A :: VariantX ( b) => A :: VariantX ( !b) ,
39
- A :: VariantY ( 0 ) => A :: VariantY ( 1 ) ,
40
- A :: VariantY ( _) => A :: VariantY ( 0 ) ,
38
+ ImplNotTraitWithoutBool :: VariantX ( b) => ImplNotTraitWithoutBool :: VariantX ( !b) ,
39
+ ImplNotTraitWithoutBool :: VariantY ( 0 ) => ImplNotTraitWithoutBool :: VariantY ( 1 ) ,
40
+ ImplNotTraitWithoutBool :: VariantY ( _) => ImplNotTraitWithoutBool :: VariantY ( 0 ) ,
41
41
}
42
42
}
43
43
}
44
44
45
45
// This type implements the Not trait with an Output of
46
46
// type bool. Using assert!(..) must be suggested
47
47
#[ derive( Debug ) ]
48
- struct B ;
48
+ struct ImplNotTraitWithBool ;
49
49
50
- impl PartialEq < bool > for B {
50
+ impl PartialEq < bool > for ImplNotTraitWithBool {
51
51
fn eq ( & self , other : & bool ) -> bool {
52
52
false
53
53
}
54
54
}
55
55
56
- impl Not for B {
56
+ impl Not for ImplNotTraitWithBool {
57
57
type Output = bool ;
58
58
59
59
fn not ( self ) -> Self :: Output {
@@ -62,8 +62,8 @@ impl Not for B {
62
62
}
63
63
64
64
fn main ( ) {
65
- let a = A :: VariantX ( true ) ;
66
- let b = B { } ;
65
+ let a = ImplNotTraitWithoutBool :: VariantX ( true ) ;
66
+ let b = ImplNotTraitWithBool ;
67
67
68
68
assert_eq ! ( "a" . len( ) , 1 ) ;
69
69
assert_eq ! ( "a" . is_empty( ) , false ) ;
0 commit comments