From 15e39729ee0b87ec364a546e655be035c051441c Mon Sep 17 00:00:00 2001 From: Dmitrij Fedorenko Date: Tue, 24 Aug 2021 22:12:16 +0300 Subject: [PATCH] macros: fix clippy::semicolon_if_nothing_returned 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 --- tokio-macros/src/entry.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index 8816a43af54..ada48a135e0 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -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=> @@ -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");