diff options
| author | David Tolnay <dtolnay@gmail.com> | 2021-12-05 10:53:21 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2021-12-05 11:32:00 -0800 |
| commit | 33c29a3ad36621bf812fd8af0adceb16188f3624 (patch) | |
| tree | 43545b24bac6c11a4cc888b2e17c8bb5ba9e7598 | |
| parent | a9f14c18fa1fe455aa9ea3efb74335653d51a884 (diff) | |
| download | rust-33c29a3ad36621bf812fd8af0adceb16188f3624.tar.gz rust-33c29a3ad36621bf812fd8af0adceb16188f3624.zip | |
Pretty print async block without redundant space
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/async-await/issues/issue-54752-async-block.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/async-await/issues/issue-54752-async-block.stderr | 8 |
3 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 593dca1b405..096406ad0e7 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -2068,7 +2068,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/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 |
