Do not skip the top-level error message in the graphical report handler.

This commit is contained in:
Luca Palmieri 2022-08-07 16:25:38 +01:00
parent f99a7b786d
commit b1f3b3df26
1 changed files with 5 additions and 3 deletions

View File

@ -149,9 +149,7 @@ impl GraphicalReportHandler {
) -> fmt::Result {
self.render_header(f, diagnostic)?;
writeln!(f)?;
if self.with_cause_chain {
self.render_causes(f, diagnostic)?;
}
self.render_causes(f, diagnostic)?;
let src = diagnostic.source_code();
self.render_snippets(f, diagnostic, src)?;
self.render_footer(f, diagnostic)?;
@ -216,6 +214,10 @@ impl GraphicalReportHandler {
writeln!(f, "{}", textwrap::fill(&diagnostic.to_string(), opts))?;
if !self.with_cause_chain {
return Ok(())
}
if let Some(mut cause_iter) = diagnostic
.diagnostic_source()
.map(DiagnosticChain::from_diagnostic)