From 8eb1891852abec863916703c0bed67b750e0a595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Fri, 6 Aug 2021 16:27:55 +0200 Subject: [PATCH 1/3] chore: explicitly relaxed clippy lint for runtime entry macro --- tokio-macros/src/entry.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index c5db13cc47b..32c89ae2805 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -325,6 +325,7 @@ fn parse_knobs( let brace_token = input.block.brace_token; input.block = syn::parse2(quote_spanned! {last_stmt_end_span=> { + #[allow(clippy::expect_used)] #rt .enable_all() .build() From 2ee2a0d346f6c63345af737344e75ccf81227963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Tue, 10 Aug 2021 22:40:21 +0200 Subject: [PATCH 2/3] fix: making the expect valid only to the builder, and not the closure itself --- tokio-macros/src/entry.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index 32c89ae2805..64e78a38217 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -325,12 +325,13 @@ fn parse_knobs( let brace_token = input.block.brace_token; input.block = syn::parse2(quote_spanned! {last_stmt_end_span=> { + let body_closure = || async #body; #[allow(clippy::expect_used)] #rt .enable_all() .build() .expect("Failed building the Runtime") - .block_on(async #body) + .block_on(body_closure()) } }) .expect("Parsing failure"); From ec1ba3bd52983abbe869f1bf93411928cd6bd270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Tue, 10 Aug 2021 22:51:29 +0200 Subject: [PATCH 3/3] fix: lazy async --- tokio-macros/src/entry.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index 64e78a38217..8816a43af54 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -325,13 +325,13 @@ fn parse_knobs( let brace_token = input.block.brace_token; input.block = syn::parse2(quote_spanned! {last_stmt_end_span=> { - let body_closure = || async #body; + let body = async #body; #[allow(clippy::expect_used)] #rt .enable_all() .build() .expect("Failed building the Runtime") - .block_on(body_closure()) + .block_on(body) } }) .expect("Parsing failure");