about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-28 09:33:36 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-28 15:51:27 +1000
commit61a66b188c41353fefc4d8840c6113a89d0b8fe2 (patch)
treec5932693e6c725b1b4a27399287687f99a650bd6
parentaff1be2637cecd0ef4224570b9ddf23f62f88b2b (diff)
downloadrust-61a66b188c41353fefc4d8840c6113a89d0b8fe2.tar.gz
rust-61a66b188c41353fefc4d8840c6113a89d0b8fe2.zip
Use `PrintState::head` in `PrintState::block_to_string`.
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs
index 070e23fddea..985359e1234 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -1013,10 +1013,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
 
     fn block_to_string(&self, blk: &ast::Block) -> String {
         Self::to_string(|s| {
-            // Containing cbox, will be closed by `print_block` at `}`.
-            let cb = s.cbox(INDENT_UNIT);
-            // Head-ibox, will be closed by `print_block` after `{`.
-            let ib = s.ibox(0);
+            let (cb, ib) = s.head("");
             s.print_block(blk, cb, ib)
         })
     }