Skip to content

Commit c202dfe

Browse files
Rollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk
Improve lint handling in rustdoc r? @oli-obk
2 parents c606ed7 + 90b3e2c commit c202dfe

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/librustdoc/core.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ pub fn run_core(search_paths: SearchPaths,
193193
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
194194
let warnings_lint_name = lint::builtin::WARNINGS.name;
195195
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
196+
197+
// In addition to those specific lints, we also need to whitelist those given through
198+
// command line, otherwise they'll get ignored and we don't want that.
199+
let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
200+
intra_link_resolution_failure_name.to_owned(),
201+
missing_docs.to_owned()];
202+
203+
for (lint, _) in &cmd_lints {
204+
whitelisted_lints.push(lint.clone());
205+
}
206+
196207
let lints = lint::builtin::HardwiredLints.get_lints()
197208
.into_iter()
198209
.chain(rustc_lint::SoftLints.get_lints().into_iter())
@@ -248,9 +259,7 @@ pub fn run_core(search_paths: SearchPaths,
248259
.filter_map(|lint| {
249260
// We don't want to whitelist *all* lints so let's
250261
// ignore those ones.
251-
if lint.name == warnings_lint_name ||
252-
lint.name == intra_link_resolution_failure_name ||
253-
lint.name == missing_docs {
262+
if whitelisted_lints.iter().any(|l| &lint.name == l) {
254263
None
255264
} else {
256265
Some(lint)

0 commit comments

Comments
 (0)