mirror of https://github.com/zkat/miette.git
fix(reporter): fix extra newline after header
This commit is contained in:
parent
02dd1f84d4
commit
0d2e3312a4
|
|
@ -28,7 +28,6 @@ impl MietteReporter {
|
||||||
write!(f, " {}:", msg)?;
|
write!(f, " {}:", msg)?;
|
||||||
}
|
}
|
||||||
writeln!(f)?;
|
writeln!(f)?;
|
||||||
writeln!(f)?;
|
|
||||||
let context_data = snippet
|
let context_data = snippet
|
||||||
.source
|
.source
|
||||||
.read_span(&snippet.context)
|
.read_span(&snippet.context)
|
||||||
|
|
@ -111,7 +110,7 @@ impl DiagnosticReporter for MietteReporter {
|
||||||
Some(Severity::Warning) => "Warning",
|
Some(Severity::Warning) => "Warning",
|
||||||
Some(Severity::Advice) => "Advice",
|
Some(Severity::Advice) => "Advice",
|
||||||
};
|
};
|
||||||
write!(f, "{}[{}]: {}", sev, diagnostic.code(), diagnostic)?;
|
writeln!(f, "{}[{}]: {}", sev, diagnostic.code(), diagnostic)?;
|
||||||
|
|
||||||
if let Some(cause) = diagnostic.source() {
|
if let Some(cause) = diagnostic.source() {
|
||||||
write!(f, "\n\nCaused by:")?;
|
write!(f, "\n\nCaused by:")?;
|
||||||
|
|
@ -135,7 +134,6 @@ impl DiagnosticReporter for MietteReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(help) = diagnostic.help() {
|
if let Some(help) = diagnostic.help() {
|
||||||
writeln!(f)?;
|
|
||||||
writeln!(f)?;
|
writeln!(f)?;
|
||||||
write!(f, "﹦{}", help)?;
|
write!(f, "﹦{}", help)?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ fn basic() -> Result<(), MietteError> {
|
||||||
};
|
};
|
||||||
let out = format!("{:?}", err);
|
let out = format!("{:?}", err);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"Error[oops::my::bad]: oops!\n﹦try doing it better next time?\n".to_string(),
|
"Error[oops::my::bad]: oops!\n\n﹦try doing it better next time?".to_string(),
|
||||||
out
|
out
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -68,6 +68,6 @@ fn fancy() -> Result<(), MietteError> {
|
||||||
};
|
};
|
||||||
let out = format!("{:?}", err);
|
let out = format!("{:?}", err);
|
||||||
// println!("{}", out);
|
// println!("{}", out);
|
||||||
assert_eq!("Error[oops::my::bad]: oops!\n\n[bad_file.rs] This is the part that broke:\n\n 1 | source\n 2 | text\n ⫶ | ^^^^ this bit here\n 3 | here\n﹦try doing it better next time?\n".to_string(), out);
|
assert_eq!("Error[oops::my::bad]: oops!\n\n[bad_file.rs] This is the part that broke:\n\n 1 | source\n 2 | text\n ⫶ | ^^^^ this bit here\n 3 | here\n﹦try doing it better next time?".to_string(), out);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue