Rollup merge of #128499 - Konippi:refactor-backtrace-formatting, r=tgross35

chore: refactor backtrace formatting

Replace `write_str()` with the `writeln!()` macro, consolidating multiple write operations.
This commit is contained in:
Matthias Krüger 2024-08-01 18:43:42 +02:00 committed by GitHub
commit e6b6d04b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -500,13 +500,8 @@ fn fmt_multiline(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
if self.show_backtrace {
let backtrace = self.backtrace();
if let Some(backtrace) = backtrace {
let backtrace = backtrace.to_string();
f.write_str("\n\nStack backtrace:\n")?;
f.write_str(backtrace.trim_end())?;
if let Some(backtrace) = self.backtrace() {
write!(f, "\n\nStack backtrace:\n{}", backtrace.to_string().trim_end())?;
}
}