Skip to content
Myr

Implement alternate debug format {:#?}

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent d324d62 · Browse files · 2 files+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−1 removed

  • other:+8 added−1 removed

2 files+8 added−1 removed

modified:src/context.rs+4 added-1 removed
100 unmodified lines
101 C: Display,102 E: Debug,103{104 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {105 write!(f, "{}\nCaused by: {:?}", self.context, self.error)105 f.debug_struct("Error")106 .field("context", &self.context.to_string())107 .field("source", &self.error)108 .finish()109 }110}111112impl<C, E> Display for ContextError<C, E>
45 unmodified lines
modified:src/error.rs+4 added
676 unmodified lines
677 }678 }679680 fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result {681 if f.alternate() {682 return Debug::fmt(self.error(), f);683 }684685 writeln!(f, "{}", self.error())?;686687 let mut chain = self.chain().skip(1).enumerate().peekable();688 if let Some((n, error)) = chain.next() {
96 unmodified lines