diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 95d45f07e9d..921ac785e81 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -2077,7 +2077,6 @@ impl<'a> State<'a> { ast::ExprKind::Async(capture_clause, _, ref blk) => { self.word_nbsp("async"); self.print_capture_clause(capture_clause); - self.s.space(); // cbox/ibox in analogy to the `ExprKind::Block` arm above self.cbox(INDENT_UNIT); self.ibox(0); diff --git a/src/test/pretty/async.rs b/src/test/pretty/async.rs new file mode 100644 index 00000000000..573e79bffd7 --- /dev/null +++ b/src/test/pretty/async.rs @@ -0,0 +1,9 @@ +// pp-exact +// pretty-compare-only +// edition:2021 + +async fn f() { + let first = async { 1 }; + let second = async move { 2 }; + join(first, second).await +} diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.rs b/src/test/ui/async-await/issues/issue-54752-async-block.rs index c2840d7386f..a8165ae6c32 100644 --- a/src/test/ui/async-await/issues/issue-54752-async-block.rs +++ b/src/test/ui/async-await/issues/issue-54752-async-block.rs @@ -3,5 +3,5 @@ // edition:2018 // pp-exact -fn main() { let _a = (async { }); } +fn main() { let _a = (async { }); } //~^ WARNING unnecessary parentheses around assigned value diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.stderr b/src/test/ui/async-await/issues/issue-54752-async-block.stderr index 0aea56ddb70..e3ed0b53356 100644 --- a/src/test/ui/async-await/issues/issue-54752-async-block.stderr +++ b/src/test/ui/async-await/issues/issue-54752-async-block.stderr @@ -1,14 +1,14 @@ warning: unnecessary parentheses around assigned value --> $DIR/issue-54752-async-block.rs:6:22 | -LL | fn main() { let _a = (async { }); } - | ^ ^ +LL | fn main() { let _a = (async { }); } + | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | -LL - fn main() { let _a = (async { }); } -LL + fn main() { let _a = async { }; } +LL - fn main() { let _a = (async { }); } +LL + fn main() { let _a = async { }; } | warning: 1 warning emitted