Skip to content

Commit

Permalink
WriterPanicked: Use debug_struct
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Tham <pickfire@riseup.net>
  • Loading branch information
ijackson and pickfire committed Dec 12, 2020
1 parent 7fab9cb commit 5ac431f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/std/src/io/buffered/bufwriter.rs
Expand Up @@ -382,7 +382,9 @@ impl fmt::Display for WriterPanicked {
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
impl fmt::Debug for WriterPanicked {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "WriterPanicked{{..buf.len={}..}}", self.buf.len())
fmt.debug_struct("WriterPanicked")
.field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity()))
.finish()
}
}

Expand Down

0 comments on commit 5ac431f

Please sign in to comment.