Skip to content

Commit

Permalink
refine CalcitErr formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Oct 11, 2021
1 parent c625acf commit 3baa4e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/primes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,14 @@ pub struct CalcitErr {

impl fmt::Display for CalcitErr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.msg)?;
if !self.warnings.is_empty() {
f.write_str("warnings:")?;
f.write_str("\n")?;
for w in &self.warnings {
write!(f, " {}", w)?;
writeln!(f, "{}", w)?;
}
}
write!(f, "Failed: {}", self.msg)
Ok(())
}
}

Expand Down

0 comments on commit 3baa4e6

Please sign in to comment.