11use serde:: de:: { self , Deserializer , Visitor } ;
22use serde:: { ser, Deserialize , Serialize } ;
33use std:: fmt;
4- use std:: hash:: { Hash , Hasher } ;
54
65#[ derive( Clone , Debug , Deserialize ) ]
76pub struct Rename {
@@ -33,32 +32,19 @@ impl DisallowedPath {
3332 }
3433}
3534
36- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , Deserialize , Serialize ) ]
35+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
3736pub enum MatchLintBehaviour {
3837 AllTypes ,
3938 WellKnownTypes ,
4039 Never ,
4140}
4241
43- #[ derive( Clone , Debug ) ]
42+ #[ derive( Debug ) ]
4443pub struct MacroMatcher {
4544 pub name : String ,
46- pub braces : ( String , String ) ,
45+ pub braces : ( char , char ) ,
4746}
4847
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-
6248impl < ' de > Deserialize < ' de > for MacroMatcher {
6349 fn deserialize < D > ( deser : D ) -> Result < Self , D :: Error >
6450 where
@@ -83,7 +69,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
8369 V : de:: MapAccess < ' de > ,
8470 {
8571 let mut name = None ;
86- let mut brace: Option < String > = None ;
72+ let mut brace: Option < char > = None ;
8773 while let Some ( key) = map. next_key ( ) ? {
8874 match key {
8975 Field :: Name => {
@@ -104,7 +90,7 @@ impl<'de> Deserialize<'de> for MacroMatcher {
10490 let brace = brace. ok_or_else ( || de:: Error :: missing_field ( "brace" ) ) ?;
10591 Ok ( MacroMatcher {
10692 name,
107- braces : [ ( "(" , ")" ) , ( "{" , "}" ) , ( "[" , "]" ) ]
93+ braces : [ ( '(' , ')' ) , ( '{' , '}' ) , ( '[' , ']' ) ]
10894 . into_iter ( )
10995 . find ( |b| b. 0 == brace)
11096 . map ( |( o, c) | ( o. to_owned ( ) , c. to_owned ( ) ) )
0 commit comments