@@ -6,7 +6,6 @@ use syn::*;
66mod kw {
77 syn:: custom_keyword!( DEBUG_FORMAT ) ;
88 syn:: custom_keyword!( MAX ) ;
9- syn:: custom_keyword!( ENCODABLE ) ;
109 syn:: custom_keyword!( custom) ;
1110 syn:: custom_keyword!( ORD_IMPL ) ;
1211}
@@ -27,7 +26,7 @@ struct Newtype(TokenStream);
2726
2827impl Parse for Newtype {
2928 fn parse ( input : ParseStream < ' _ > ) -> Result < Self > {
30- let attrs = input. call ( Attribute :: parse_outer) ?;
29+ let mut attrs = input. call ( Attribute :: parse_outer) ?;
3130 let vis: Visibility = input. parse ( ) ?;
3231 input. parse :: < Token ! [ struct ] > ( ) ?;
3332 let name: Ident = input. parse ( ) ?;
@@ -51,6 +50,17 @@ impl Parse for Newtype {
5150 Ok ( ( ) )
5251 } ;
5352
53+ attrs. retain ( |attr| match attr. path . get_ident ( ) {
54+ Some ( ident) => match & * ident. to_string ( ) {
55+ "custom_encodable" => {
56+ encodable = false ;
57+ false
58+ }
59+ _ => true ,
60+ } ,
61+ _ => true ,
62+ } ) ;
63+
5464 if body. lookahead1 ( ) . peek ( Token ! [ ..] ) {
5565 body. parse :: < Token ! [ ..] > ( ) ?;
5666 } else {
@@ -81,14 +91,6 @@ impl Parse for Newtype {
8191 }
8292 continue ;
8393 }
84- if body. lookahead1 ( ) . peek ( kw:: ENCODABLE ) {
85- body. parse :: < kw:: ENCODABLE > ( ) ?;
86- body. parse :: < Token ! [ =] > ( ) ?;
87- body. parse :: < kw:: custom > ( ) ?;
88- try_comma ( ) ?;
89- encodable = false ;
90- continue ;
91- }
9294 if body. lookahead1 ( ) . peek ( kw:: ORD_IMPL ) {
9395 body. parse :: < kw:: ORD_IMPL > ( ) ?;
9496 body. parse :: < Token ! [ =] > ( ) ?;
0 commit comments