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 committed Aug 1, 2024
2 parents bad2f0b + 45d35ba commit 7444aff
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 7444aff

Please sign in to comment.