Skip to content

Commit

Permalink
Rollup merge of rust-lang#128499 - Konippi:refactor-backtrace-formatt…
Browse files Browse the repository at this point in the history
…ing, r=tgross35

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 fb966d2 + 2614bd2 commit f859e54
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions 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 f859e54

Please sign in to comment.