diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index 8f80499b8..ae8c0b9d9 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -254,7 +254,7 @@ fn parse_knobs( .enable_all() .build() .unwrap() - .block_on(async { #body }) + .block_on(async #body) } }; diff --git a/tokio/tests/macros_test.rs b/tokio/tests/macros_test.rs index 8e68b8a44..839639814 100644 --- a/tokio/tests/macros_test.rs +++ b/tokio/tests/macros_test.rs @@ -17,3 +17,11 @@ async fn test_macro_is_resilient_to_shadowing() { .await .unwrap(); } + +// https://github.com/tokio-rs/tokio/issues/3403 +#[rustfmt::skip] // this `rustfmt::skip` is necessary because unused_braces does not warn if the block contains newline. +#[tokio::main] +async fn unused_braces_main() { println!("hello") } +#[rustfmt::skip] // this `rustfmt::skip` is necessary because unused_braces does not warn if the block contains newline. +#[tokio::test] +async fn unused_braces_test() { assert_eq!(1 + 1, 2) }