Skip to content

Commit

Permalink
Auto merge of #80395 - ehuss:lint-docs-warn-missing, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
lint-docs: Warn on missing lint when documenting.

In #79522, I missed converting one of the errors to a warning, in the situation where a lint is missing.  This was unearthed by the renaming of overlapping-patterns (#78242).  This will still be validated during the test phase.
  • Loading branch information
bors committed Dec 27, 2020
2 parents 0fbc0ce + 9666215 commit 7e02465
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/tools/lint-docs/src/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,23 @@ impl<'a> LintExtractor<'a> {
result.push('\n');
result.push_str("[warn-by-default]: listing/warn-by-default.md\n");
for lint_name in to_link {
let lint_def =
lints.iter().find(|l| l.name == lint_name.replace("-", "_")).ok_or_else(|| {
format!(
"`rustc -W help` defined lint `{}` but that lint does not appear to exist",
let lint_def = match lints.iter().find(|l| l.name == lint_name.replace("-", "_")) {
Some(def) => def,
None => {
let msg = format!(
"`rustc -W help` defined lint `{}` but that lint does not \
appear to exist\n\
Check that the lint definition includes the appropriate doc comments.",
lint_name
)
})?;
);
if self.validate {
return Err(msg.into());
} else {
eprintln!("warning: {}", msg);
continue;
}
}
};
write!(
result,
"[{}]: listing/{}#{}\n",
Expand Down

0 comments on commit 7e02465

Please sign in to comment.