mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #92412 - dtolnay:tryspace, r=Mark-Simulacrum
Fix double space in pretty printed TryBlock Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($expr:expr) => { stringify!($expr) }; } fn main() { println!("{}", repro!(try {})); } ``` Before: <code>try {}</code> After: <code>try {}</code> The `head` helper already appends a space:2b67c30bfe/compiler/rustc_ast_pretty/src/pprust/state.rs (L654-L664)
so doing `head` followed by `space` resulted in a double space:2b67c30bfe/compiler/rustc_ast_pretty/src/pprust/state.rs (L2241-L2242)
This commit is contained in:
commit
682b4cbc4e
@ -2241,7 +2241,6 @@ impl<'a> State<'a> {
|
||||
}
|
||||
ast::ExprKind::TryBlock(ref blk) => {
|
||||
self.head("try");
|
||||
self.space();
|
||||
self.print_block_with_attrs(blk, attrs)
|
||||
}
|
||||
ast::ExprKind::Err => {
|
||||
|
@ -256,7 +256,7 @@ fn test_expr() {
|
||||
assert_eq!(stringify_expr!(expr.await), "expr.await");
|
||||
|
||||
// ExprKind::TryBlock
|
||||
assert_eq!(stringify_expr!(try {}), "try {}"); // FIXME
|
||||
assert_eq!(stringify_expr!(try {}), "try {}");
|
||||
|
||||
// ExprKind::Assign
|
||||
assert_eq!(stringify_expr!(expr = true), "expr = true");
|
||||
|
Loading…
Reference in New Issue
Block a user