diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-07 11:05:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-07 11:05:06 +0100 |
| commit | b2dcfddb24df78ec660b498ddf780550ba052119 (patch) | |
| tree | 68734e75c6c9c691b0aee3a678eac6a9bc7899f8 /compiler | |
| parent | 1c2fba65406e1d901194ec4c2c3162ba10e45f5b (diff) | |
| parent | 33c29a3ad36621bf812fd8af0adceb16188f3624 (diff) | |
Rollup merge of #91562 - dtolnay:asyncspace, r=Mark-Simulacrum
Pretty print async block without redundant space
**Repro:**
```rust
macro_rules! m {
($e:expr) => { stringify!($e) };
}
fn main() {
println!("{:?}", m!(async {}));
}
```
**Before:** <code>"async {}"</code>
**After:** `"async {}"`
<br>
In this function:
https://github.com/rust-lang/rust/blob/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_ast_pretty/src/pprust/state.rs#L2049-L2051
the `print_capture_clause` and `word_nbsp`/`word_space` calls already put a space after the `async` and `move` keywords being printed. The extra `self.s.space()` call removed by this PR resulted in the redundant double space.
https://github.com/rust-lang/rust/blob/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_ast_pretty/src/pprust/state.rs#L2640-L2645
https://github.com/rust-lang/rust/blob/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_ast_pretty/src/helpers.rs#L34-L37
https://github.com/rust-lang/rust/blob/65c55bf931a55e6b1e5ed14ad8623814a7386424/compiler/rustc_ast_pretty/src/helpers.rs#L5-L8
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 1 |
1 files changed, 0 insertions, 1 deletions
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); |
