Downgrade some unnecessary runtime asserts to debug_assert

This commit is contained in:
David Tolnay 2020-05-09 20:22:14 -07:00
parent eb383c08b2
commit 6ca3752e9d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -470,7 +470,7 @@ where
F: Formatter,
{
fn write_str(&mut self, s: &str) -> fmt::Result {
assert!(self.error.is_none());
debug_assert!(self.error.is_none());
match format_escaped_str_contents(self.writer, self.formatter, s) {
Ok(()) => Ok(()),
Err(err) => {
@ -492,7 +492,7 @@ where
error: None,
};
match write!(adapter, "{}", value) {
Ok(()) => assert!(adapter.error.is_none()),
Ok(()) => debug_assert!(adapter.error.is_none()),
Err(fmt::Error) => {
return Err(Error::io(adapter.error.expect("there should be an error")));
}