@@ -9,11 +9,10 @@ use proc_macro::TokenStream;
9
9
use quote:: quote;
10
10
use syn:: {
11
11
parse:: { Parse , Parser } ,
12
- spanned:: Spanned ,
13
12
parse_quote,
13
+ spanned:: Spanned ,
14
14
} ;
15
15
16
-
17
16
#[ proc_macro_attribute]
18
17
pub fn quickcheck ( _args : TokenStream , input : TokenStream ) -> TokenStream {
19
18
let output = match syn:: Item :: parse. parse ( input. clone ( ) ) {
@@ -24,13 +23,11 @@ pub fn quickcheck(_args: TokenStream, input: TokenStream) -> TokenStream {
24
23
item_fn. decl . inputs . iter ( ) . for_each ( |input| match * input {
25
24
syn:: FnArg :: Captured ( syn:: ArgCaptured { ref ty, .. } ) => {
26
25
inputs. push ( parse_quote ! ( _: #ty) ) ;
27
- } ,
28
- _ => {
29
- errors. push ( syn:: parse:: Error :: new (
30
- input. span ( ) ,
31
- "unsupported kind of function argument" ,
32
- ) )
33
- } ,
26
+ }
27
+ _ => errors. push ( syn:: parse:: Error :: new (
28
+ input. span ( ) ,
29
+ "unsupported kind of function argument" ,
30
+ ) ) ,
34
31
} ) ;
35
32
36
33
if errors. is_empty ( ) {
@@ -56,9 +53,12 @@ pub fn quickcheck(_args: TokenStream, input: TokenStream) -> TokenStream {
56
53
}
57
54
}
58
55
} else {
59
- errors. iter ( ) . map ( syn:: parse:: Error :: to_compile_error) . collect ( )
56
+ errors
57
+ . iter ( )
58
+ . map ( syn:: parse:: Error :: to_compile_error)
59
+ . collect ( )
60
60
}
61
- } ,
61
+ }
62
62
Ok ( syn:: Item :: Static ( mut item_static) ) => {
63
63
let attrs = mem:: replace ( & mut item_static. attrs , Vec :: new ( ) ) ;
64
64
let name = & item_static. ident ;
@@ -71,10 +71,11 @@ pub fn quickcheck(_args: TokenStream, input: TokenStream) -> TokenStream {
71
71
:: quickcheck:: quickcheck( #name)
72
72
}
73
73
}
74
- } ,
74
+ }
75
75
_ => {
76
76
let span = proc_macro2:: TokenStream :: from ( input) . span ( ) ;
77
- let msg = "#[quickcheck] is only supported on statics and functions" ;
77
+ let msg =
78
+ "#[quickcheck] is only supported on statics and functions" ;
78
79
79
80
syn:: parse:: Error :: new ( span, msg) . to_compile_error ( )
80
81
}
0 commit comments