macros: fix unused_braces in generated code (#3404)

This commit is contained in:
Taiki Endo
2021-01-11 19:20:40 +09:00
committed by GitHub
parent 0b8bdf9d32
commit 40d959263b
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ fn parse_knobs(
.enable_all()
.build()
.unwrap()
.block_on(async { #body })
.block_on(async #body)
}
};
+8
View File
@@ -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) }