io::Write::write_fmt: panic if the formatter fails when the stream does not fail
This commit is contained in:
parent
ef15976387
commit
e00f27b7be
3 changed files with 26 additions and 13 deletions
|
@ -1839,7 +1839,11 @@ pub trait Write {
|
|||
if output.error.is_err() {
|
||||
output.error
|
||||
} else {
|
||||
Err(error::const_io_error!(ErrorKind::Uncategorized, "formatter error"))
|
||||
// This shouldn't happen: the underlying stream did not error, but somehow
|
||||
// the formatter still errored?
|
||||
panic!(
|
||||
"a formatting trait implementation returned an error when the underlying stream did not"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue