Skip to content

Commit 7e02465

Browse files
committed
Auto merge of rust-lang#80395 - ehuss:lint-docs-warn-missing, r=Mark-Simulacrum
lint-docs: Warn on missing lint when documenting. In rust-lang#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 (rust-lang#78242). This will still be validated during the test phase.
2 parents 0fbc0ce + 9666215 commit 7e02465

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/tools/lint-docs/src/groups.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,23 @@ impl<'a> LintExtractor<'a> {
116116
result.push('\n');
117117
result.push_str("[warn-by-default]: listing/warn-by-default.md\n");
118118
for lint_name in to_link {
119-
let lint_def =
120-
lints.iter().find(|l| l.name == lint_name.replace("-", "_")).ok_or_else(|| {
121-
format!(
122-
"`rustc -W help` defined lint `{}` but that lint does not appear to exist",
119+
let lint_def = match lints.iter().find(|l| l.name == lint_name.replace("-", "_")) {
120+
Some(def) => def,
121+
None => {
122+
let msg = format!(
123+
"`rustc -W help` defined lint `{}` but that lint does not \
124+
appear to exist\n\
125+
Check that the lint definition includes the appropriate doc comments.",
123126
lint_name
124-
)
125-
})?;
127+
);
128+
if self.validate {
129+
return Err(msg.into());
130+
} else {
131+
eprintln!("warning: {}", msg);
132+
continue;
133+
}
134+
}
135+
};
126136
write!(
127137
result,
128138
"[{}]: listing/{}#{}\n",

0 commit comments

Comments
 (0)