Skip to content

Commit d3e19e3

Browse files
committed
fix(macros): items_after_statements Clippy warning, closes #4639
1 parent 47666c4 commit d3e19e3

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-macros": patch
3+
---
4+
5+
Adjust command imports to fix `items_after_statements` Clippy warning.

‎core/tauri-macros/src/command/wrapper.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ pub fn wrapper(attributes: TokenStream, item: TokenStream) -> TokenStream {
8282
macro_rules! #wrapper {
8383
// double braces because the item is expected to be a block expression
8484
($path:path, $invoke:ident) => {{
85+
#[allow(unused_imports)]
86+
use ::tauri::command::private::*;
8587
// prevent warnings when the body is a `compile_error!` or if the command has no arguments
8688
#[allow(unused_variables)]
8789
let ::tauri::Invoke { message: #message, resolver: #resolver } = $invoke;
@@ -106,9 +108,6 @@ fn body_async(function: &ItemFn, invoke: &Invoke) -> syn::Result<TokenStream2> {
106108
let Invoke { message, resolver } = invoke;
107109
parse_args(function, message).map(|args| {
108110
quote! {
109-
#[allow(unused_imports)]
110-
use ::tauri::command::private::*;
111-
112111
#resolver.respond_async_serialized(async move {
113112
let result = $path(#(#args?),*);
114113
let kind = (&result).async_kind();
@@ -134,9 +133,6 @@ fn body_blocking(function: &ItemFn, invoke: &Invoke) -> syn::Result<TokenStream2
134133
});
135134

136135
Ok(quote! {
137-
#[allow(unused_imports)]
138-
use ::tauri::command::private::*;
139-
140136
let result = $path(#(match #args #match_body),*);
141137
let kind = (&result).blocking_kind();
142138
kind.block(result, #resolver);

0 commit comments

Comments
 (0)