about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-05-11 14:23:37 +0200
committerRalf Jung <post@ralfj.de>2024-05-11 15:13:18 +0200
commite00f27b7be9084e548f7197325c2f343e8ad27b9 (patch)
tree399eb44538581c7768b37e9cf9d2a029b21f1022 /library/alloc/src
parentef15976387ad9c1cdceaabf469e0cf35f5852f6d (diff)
io::Write::write_fmt: panic if the formatter fails when the stream does not fail
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/fmt.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs
index b9918752540..34f87bbf9e4 100644
--- a/library/alloc/src/fmt.rs
+++ b/library/alloc/src/fmt.rs
@@ -630,7 +630,9 @@ pub fn format(args: Arguments<'_>) -> string::String {
     fn format_inner(args: Arguments<'_>) -> string::String {
         let capacity = args.estimated_capacity();
         let mut output = string::String::with_capacity(capacity);
-        output.write_fmt(args).expect("a formatting trait implementation returned an error");
+        output
+            .write_fmt(args)
+            .expect("a formatting trait implementation returned an error when the underlying stream did not");
         output
     }