mirror of https://github.com/zkat/miette.git
Only print a newline sep. when there is a header
This commit is contained in:
parent
66af796c99
commit
4791251b58
|
|
@ -151,7 +151,6 @@ impl GraphicalReportHandler {
|
|||
diagnostic: &(dyn Diagnostic),
|
||||
) -> fmt::Result {
|
||||
self.render_header(f, diagnostic)?;
|
||||
writeln!(f)?;
|
||||
self.render_causes(f, diagnostic)?;
|
||||
let src = diagnostic.source_code();
|
||||
self.render_snippets(f, diagnostic, src)?;
|
||||
|
|
@ -190,6 +189,7 @@ impl GraphicalReportHandler {
|
|||
);
|
||||
write!(header, "{}", link)?;
|
||||
writeln!(f, "{}", header)?;
|
||||
writeln!(f)?;
|
||||
} else if let Some(code) = diagnostic.code() {
|
||||
write!(header, "{}", code.style(severity_style),)?;
|
||||
if self.links == LinkStyle::Text && diagnostic.url().is_some() {
|
||||
|
|
@ -197,6 +197,7 @@ impl GraphicalReportHandler {
|
|||
write!(header, " ({})", url.style(self.theme.styles.link))?;
|
||||
}
|
||||
writeln!(f, "{}", header)?;
|
||||
writeln!(f)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -301,7 +302,6 @@ impl GraphicalReportHandler {
|
|||
Some(Severity::Advice) => write!(f, "Advice: ")?,
|
||||
};
|
||||
self.render_header(f, rel)?;
|
||||
writeln!(f)?;
|
||||
self.render_causes(f, rel)?;
|
||||
let src = rel.source_code().or(parent_src);
|
||||
self.render_snippets(f, rel, src)?;
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ fn single_line_highlight_span_full_line() {
|
|||
let out = fmt_report(err.into());
|
||||
println!("Error: {}", out);
|
||||
|
||||
let expected = r#"
|
||||
× oops!
|
||||
let expected = r#" × oops!
|
||||
╭─[issue:1:1]
|
||||
1 │ source
|
||||
2 │ text
|
||||
|
|
@ -1201,8 +1200,7 @@ fn zero_length_eol_span() {
|
|||
let out = fmt_report(err.into());
|
||||
println!("Error: {}", out);
|
||||
|
||||
let expected = r#"
|
||||
× oops!
|
||||
let expected = r#" × oops!
|
||||
╭─[issue:1:1]
|
||||
1 │ this is the first line
|
||||
2 │ this is the second line
|
||||
|
|
|
|||
Loading…
Reference in New Issue