1
1
use serde:: de:: { self , Deserializer , Visitor } ;
2
2
use serde:: { ser, Deserialize , Serialize } ;
3
3
use std:: fmt;
4
- use std:: hash:: { Hash , Hasher } ;
5
4
6
5
#[ derive( Clone , Debug , Deserialize ) ]
7
6
pub struct Rename {
@@ -33,32 +32,19 @@ impl DisallowedPath {
33
32
}
34
33
}
35
34
36
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , Deserialize , Serialize ) ]
35
+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
37
36
pub enum MatchLintBehaviour {
38
37
AllTypes ,
39
38
WellKnownTypes ,
40
39
Never ,
41
40
}
42
41
43
- #[ derive( Clone , Debug ) ]
42
+ #[ derive( Debug ) ]
44
43
pub struct MacroMatcher {
45
44
pub name : String ,
46
- pub braces : ( String , String ) ,
45
+ pub braces : ( char , char ) ,
47
46
}
48
47
49
- impl Hash for MacroMatcher {
50
- fn hash < H : Hasher > ( & self , state : & mut H ) {
51
- self . name . hash ( state) ;
52
- }
53
- }
54
-
55
- impl PartialEq for MacroMatcher {
56
- fn eq ( & self , other : & Self ) -> bool {
57
- self . name == other. name
58
- }
59
- }
60
- impl Eq for MacroMatcher { }
61
-
62
48
impl < ' de > Deserialize < ' de > for MacroMatcher {
63
49
fn deserialize < D > ( deser : D ) -> Result < Self , D :: Error >
64
50
where
@@ -83,7 +69,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
83
69
V : de:: MapAccess < ' de > ,
84
70
{
85
71
let mut name = None ;
86
- let mut brace: Option < String > = None ;
72
+ let mut brace: Option < char > = None ;
87
73
while let Some ( key) = map. next_key ( ) ? {
88
74
match key {
89
75
Field :: Name => {
@@ -104,7 +90,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
104
90
let brace = brace. ok_or_else ( || de:: Error :: missing_field ( "brace" ) ) ?;
105
91
Ok ( MacroMatcher {
106
92
name,
107
- braces : [ ( "(" , ")" ) , ( "{" , "}" ) , ( "[" , "]" ) ]
93
+ braces : [ ( '(' , ')' ) , ( '{' , '}' ) , ( '[' , ']' ) ]
108
94
. into_iter ( )
109
95
. find ( |b| b. 0 == brace)
110
96
. map ( |( o, c) | ( o. to_owned ( ) , c. to_owned ( ) ) )
0 commit comments