Adjust formatting

This commit is contained in:
Michael Pfaff 2023-07-03 18:44:28 -04:00
parent 60b4547267
commit ae7281abac
Signed by: michael
GPG Key ID: CF402C4A012AA9D4
3 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,8 @@ fn main0() -> Result<()> {
"The engine broke down" "The engine broke down"
.with("Remember: you aren't good with cars") .with("Remember: you aren't good with cars")
.with("Suggestion: call a tow truck") .with("Suggestion: call a tow truck")
.with("Foo".with("Bar").with("Baz")), .with("Foo".with("Bar").with("Baz"))
.with("Foo\nBar"),
) )
.context( .context(
"While driving down a road" "While driving down a road"

View File

@ -58,7 +58,7 @@ impl fmt::Display for Context {
let opts = ReportOpts::default(); let opts = ReportOpts::default();
for detail in &self.extra { for detail in &self.extra {
f.write_str("\n")?; f.write_str("\n")?;
report_write!(f, &opts.indent().next(), "- {detail}")?; report_write!(f, &opts.indent().indent().next(), " - {detail}")?;
} }
Ok(()) Ok(())
} }

View File

@ -140,12 +140,11 @@ impl std::error::Error for How {}
impl std::fmt::Display for How { impl std::fmt::Display for How {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let opts = ReportOpts::default();
for (i, ctx) in self.0.context.iter().enumerate() { for (i, ctx) in self.0.context.iter().enumerate() {
if i != 0 { if i != 0 {
f.write_str("\n")?; f.write_str("\n")?;
} }
report_write!(f, &opts.indent().next(), "{ctx}")?; std::fmt::Display::fmt(ctx, f)?;
} }
Ok(()) Ok(())
} }