Include non-JSON output in error display for lint-doc failure.

Some errors, like if rustc is broken, or dylib search path is wrong,
will only display non-JSON errors. Show those, too, to make it easier to
debug a problem.
This commit is contained in:
Eric Huss 2020-09-14 14:42:37 -07:00
parent 57c5f40cf4
commit 32efcfca2f

View file

@ -402,9 +402,12 @@ fn generate_lint_output(
None => {
let rendered: Vec<&str> =
msgs.iter().filter_map(|msg| msg["rendered"].as_str()).collect();
let non_json: Vec<&str> =
stderr.lines().filter(|line| !line.starts_with('{')).collect();
Err(format!(
"did not find lint `{}` in output of example, got:\n{}",
"did not find lint `{}` in output of example, got:\n{}\n{}",
name,
non_json.join("\n"),
rendered.join("\n")
)
.into())