From ae7281abacaf243ba50b623c5dff18a8cafd10a7 Mon Sep 17 00:00:00 2001 From: Michael Pfaff Date: Mon, 3 Jul 2023 18:44:28 -0400 Subject: [PATCH] Adjust formatting --- examples/output.rs | 3 ++- src/context.rs | 2 +- src/how.rs | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/output.rs b/examples/output.rs index 558373b..9041092 100644 --- a/examples/output.rs +++ b/examples/output.rs @@ -5,7 +5,8 @@ fn main0() -> Result<()> { "The engine broke down" .with("Remember: you aren't good with cars") .with("Suggestion: call a tow truck") - .with("Foo".with("Bar").with("Baz")), + .with("Foo".with("Bar").with("Baz")) + .with("Foo\nBar"), ) .context( "While driving down a road" diff --git a/src/context.rs b/src/context.rs index 04fd567..521678d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -58,7 +58,7 @@ impl fmt::Display for Context { let opts = ReportOpts::default(); for detail in &self.extra { f.write_str("\n")?; - report_write!(f, &opts.indent().next(), "- {detail}")?; + report_write!(f, &opts.indent().indent().next(), " - {detail}")?; } Ok(()) } diff --git a/src/how.rs b/src/how.rs index f6dbaa0..cf7fc0b 100644 --- a/src/how.rs +++ b/src/how.rs @@ -140,12 +140,11 @@ impl std::error::Error for How {} impl std::fmt::Display for How { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let opts = ReportOpts::default(); for (i, ctx) in self.0.context.iter().enumerate() { if i != 0 { f.write_str("\n")?; } - report_write!(f, &opts.indent().next(), "{ctx}")?; + std::fmt::Display::fmt(ctx, f)?; } Ok(()) }