about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-07-11 10:02:01 +0200
committerGitHub <noreply@github.com>2018-07-11 10:02:01 +0200
commitc202dfea9b42d10ff1980ae3664b3d1840d5f0a8 (patch)
treef03a933087e987811a1d3221032bb41edb179490 /src
parentc606ed74c380f512feaaa0a864e09bdee51f3f81 (diff)
parent90b3e2c1c8117965a6f7175987409b2ab4de8453 (diff)
downloadrust-c202dfea9b42d10ff1980ae3664b3d1840d5f0a8.tar.gz
rust-c202dfea9b42d10ff1980ae3664b3d1840d5f0a8.zip
Rollup merge of #52233 - GuillaumeGomez:rustdoc-lint-handling, r=oli-obk
Improve lint handling in rustdoc

r? @oli-obk
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/core.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 417a78b2a3a..0a56c639220 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -193,6 +193,17 @@ pub fn run_core(search_paths: SearchPaths,
     let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
     let warnings_lint_name = lint::builtin::WARNINGS.name;
     let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
+
+    // In addition to those specific lints, we also need to whitelist those given through
+    // command line, otherwise they'll get ignored and we don't want that.
+    let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
+                                     intra_link_resolution_failure_name.to_owned(),
+                                     missing_docs.to_owned()];
+
+    for (lint, _) in &cmd_lints {
+        whitelisted_lints.push(lint.clone());
+    }
+
     let lints = lint::builtin::HardwiredLints.get_lints()
                     .into_iter()
                     .chain(rustc_lint::SoftLints.get_lints().into_iter())
@@ -248,9 +259,7 @@ pub fn run_core(search_paths: SearchPaths,
                                      .filter_map(|lint| {
                                          // We don't want to whitelist *all* lints so let's
                                          // ignore those ones.
-                                         if lint.name == warnings_lint_name ||
-                                            lint.name == intra_link_resolution_failure_name ||
-                                            lint.name == missing_docs {
+                                         if whitelisted_lints.iter().any(|l| &lint.name == l) {
                                              None
                                          } else {
                                              Some(lint)