Skip to content

Commit

Permalink
Rollup merge of #128499 - Konippi:refactor-backtrace-formatting, r=tg…
Browse files Browse the repository at this point in the history
…ross35

chore: refactor backtrace formatting

Replace `write_str()` with the `writeln!()` macro, consolidating multiple write operations.
  • Loading branch information
matthiaskrgr authored Aug 1, 2024
2 parents ca73b8b + 45d35ba commit e6b6d04
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,8 @@ where
}

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())?;
}
}

Expand Down

0 comments on commit e6b6d04

Please sign in to comment.