|
@@ -82,6 +82,8 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
macro_rules! #wrapper {
|
|
|
// double braces because the item is expected to be a block expression
|
|
|
($path:path, $invoke:ident) => {{
|
|
|
+ #[allow(unused_imports)]
|
|
|
+ use ::tauri::command::private::*;
|
|
|
// prevent warnings when the body is a `compile_error!` or if the command has no arguments
|
|
|
#[allow(unused_variables)]
|
|
|
let ::tauri::Invoke { message: #message, resolver: #resolver } = $invoke;
|
|
@@ -106,9 +108,6 @@ fn body_async(function: &ItemFn, invoke: &Invoke) -> syn::Result<TokenStream2> {
|
|
|
let Invoke { message, resolver } = invoke;
|
|
|
parse_args(function, message).map(|args| {
|
|
|
quote! {
|
|
|
- #[allow(unused_imports)]
|
|
|
- use ::tauri::command::private::*;
|
|
|
-
|
|
|
#resolver.respond_async_serialized(async move {
|
|
|
let result = $path(#(#args?),*);
|
|
|
let kind = (&result).async_kind();
|
|
@@ -134,9 +133,6 @@ fn body_blocking(function: &ItemFn, invoke: &Invoke) -> syn::Result<TokenStream2
|
|
|
});
|
|
|
|
|
|
Ok(quote! {
|
|
|
- #[allow(unused_imports)]
|
|
|
- use ::tauri::command::private::*;
|
|
|
-
|
|
|
let result = $path(#(match #args #match_body),*);
|
|
|
let kind = (&result).blocking_kind();
|
|
|
kind.block(result, #resolver);
|