File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
use proc_macro:: TokenStream ;
2
2
use quote:: quote;
3
3
4
- pub ( crate ) fn test ( _: TokenStream , item : TokenStream ) -> TokenStream {
4
+ pub ( crate ) fn test ( args : TokenStream , item : TokenStream ) -> TokenStream {
5
+ if !args. is_empty ( ) {
6
+ return syn:: Error :: new_spanned ( args, "invalid argument" ) )
7
+ . to_compile_error ( )
8
+ . into ( ) ;
9
+ }
5
10
let mut input = syn:: parse_macro_input!( item as syn:: ItemFn ) ;
6
11
let attrs = & input. attrs ;
7
12
let vis = & input. vis ;
8
13
let sig = & mut input. sig ;
9
14
let body = & input. block ;
10
15
11
- if sig. asyncness . is_none ( ) {
16
+ if sig. asyncness . take ( ) . is_none ( ) {
12
17
return syn:: Error :: new_spanned ( sig. fn_token , "Only async functions are supported" )
13
18
. to_compile_error ( )
14
19
. into ( ) ;
15
20
}
16
21
17
- sig. asyncness = None ;
18
-
19
22
let gen = quote ! {
23
+ #[ :: core:: prelude:: v1:: test]
20
24
#( #attrs) *
21
25
#vis #sig {
22
- :: futures_test:: __private:: block_on( async move { #body } )
26
+ :: futures_test:: __private:: block_on( async move #body)
23
27
}
24
28
} ;
25
29
You can’t perform that action at this time.
0 commit comments