about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIan Jackson <ijackson+github@slimy.greenend.org.uk>2020-12-12 13:37:29 +0000
committerGitHub <noreply@github.com>2020-12-12 13:37:29 +0000
commit5ac431fb084e32b8ea86b800c98738ce49ddab37 (patch)
tree0ea4e7c41b7e2021edcab89610069c336fccd8af
parent7fab9cb8acdd8f2cab1271c0d7dfb268f2048f23 (diff)
downloadrust-5ac431fb084e32b8ea86b800c98738ce49ddab37.tar.gz
rust-5ac431fb084e32b8ea86b800c98738ce49ddab37.zip
WriterPanicked: Use debug_struct
Co-authored-by: Ivan Tham <pickfire@riseup.net>
-rw-r--r--library/std/src/io/buffered/bufwriter.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/io/buffered/bufwriter.rs b/library/std/src/io/buffered/bufwriter.rs
index 94e625b9410..4319febbf91 100644
--- a/library/std/src/io/buffered/bufwriter.rs
+++ b/library/std/src/io/buffered/bufwriter.rs
@@ -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()
     }
 }