Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Jun 5, 2020
1 parent 207f94e commit bdd2f33
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,18 @@ impl fmt::Debug for Backtrace {
// short format, because if it's full we presumably want to print
// everything.
let cwd = std::env::current_dir();
let mut print_path = move |fmt: &mut fmt::Formatter<'_>, path: crate::BytesOrWideString<'_>| {
let path = path.into_path_buf();
if !full {
if let Ok(cwd) = &cwd {
if let Ok(suffix) = path.strip_prefix(cwd) {
return fmt::Display::fmt(&suffix.display(), fmt);
let mut print_path =
move |fmt: &mut fmt::Formatter<'_>, path: crate::BytesOrWideString<'_>| {
let path = path.into_path_buf();
if !full {
if let Ok(cwd) = &cwd {
if let Ok(suffix) = path.strip_prefix(cwd) {
return fmt::Display::fmt(&suffix.display(), fmt);
}
}
}
}
fmt::Display::fmt(&path.display(), fmt)
};
fmt::Display::fmt(&path.display(), fmt)
};

let mut f = BacktraceFmt::new(fmt, style, &mut print_path);
f.add_context()?;
Expand Down

0 comments on commit bdd2f33

Please sign in to comment.