From 6797bfd203dea6601548098214504375ad0e45ac Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 10 Feb 2020 21:38:59 -0800 Subject: [PATCH] rule over the code in libstd with an iron fist --- src/libstd/backtrace.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/libstd/backtrace.rs b/src/libstd/backtrace.rs index 448b988d99c..391d22df5e5 100644 --- a/src/libstd/backtrace.rs +++ b/src/libstd/backtrace.rs @@ -168,11 +168,7 @@ impl fmt::Debug for Backtrace { }; capture.resolve(); - let frames = if fmt.alternate() { - &capture.frames[..] - } else { - &capture.frames[capture.actual_start..] - }; + let frames = &capture.frames[capture.actual_start..]; write!(fmt, "Backtrace ")?; @@ -195,10 +191,9 @@ impl fmt::Debug for BacktraceSymbol { write!(fmt, "{{ ")?; if let Some(fn_name) = self.name.as_ref().map(|b| backtrace::SymbolName::new(b)) { - write!(fmt, "fn: ")?; - fmt::Display::fmt(&fn_name, fmt)?; + write!(fmt, "fn: \"{}\"", fn_name)?; } else { - write!(fmt, "fn: ")?; + write!(fmt, "fn: \"\"")?; } if let Some(fname) = self.filename.as_ref() { @@ -221,7 +216,7 @@ impl fmt::Debug for BytesOrWide { BytesOrWide::Bytes(w) => BytesOrWideString::Bytes(w), BytesOrWide::Wide(w) => BytesOrWideString::Wide(w), }, - if fmt.alternate() { backtrace::PrintFmt::Full } else { backtrace::PrintFmt::Short }, + backtrace::PrintFmt::Short, crate::env::current_dir().as_ref().ok(), ) }