Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 5ac431f

Browse files
ijacksonpickfire
andauthored
WriterPanicked: Use debug_struct
Co-authored-by: Ivan Tham <[email protected]>
1 parent 7fab9cb commit 5ac431f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/std/src/io/buffered/bufwriter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ impl fmt::Display for WriterPanicked {
382382
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
383383
impl fmt::Debug for WriterPanicked {
384384
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
385-
write!(f, "WriterPanicked{{..buf.len={}..}}", self.buf.len())
385+
fmt.debug_struct("WriterPanicked")
386+
.field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity()))
387+
.finish()
386388
}
387389
}
388390

0 commit comments

Comments
 (0)