Skip to content

Commit

Permalink
macros: fix clippy::semicolon_if_nothing_returned
Browse files Browse the repository at this point in the history
Beginning from version 0.1.54 (or earlier)
`clippy::semicolon_if_nothing_returned` braked by macroses `tokio::test`
and `tokio::main` on functions without result type.

Adding semicolon into function wrappers fix it.

Fixes: rust-lang/rust-clippy#7438
  • Loading branch information
c0va23 committed Aug 24, 2021
1 parent 7e47464 commit 15e3972
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tokio-macros/src/entry.rs
Expand Up @@ -321,6 +321,12 @@ fn parse_knobs(
quote! {}
};

let tail_semicolon = match input.sig.output {
syn::ReturnType::Default => quote! {
;
},
syn::ReturnType::Type(..) => quote! {},
};
let body = &input.block;
let brace_token = input.block.brace_token;
input.block = syn::parse2(quote_spanned! {last_stmt_end_span=>
Expand All @@ -331,7 +337,7 @@ fn parse_knobs(
.enable_all()
.build()
.expect("Failed building the Runtime")
.block_on(body)
.block_on(body)#tail_semicolon
}
})
.expect("Parsing failure");
Expand Down

0 comments on commit 15e3972

Please sign in to comment.