diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-05 20:06:33 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-05 20:06:33 +0200 |
| commit | 92cda8c7da86b6770a483bc45ce32c8b94b019ec (patch) | |
| tree | c55d02fcb59d335d3f572eedb2ac6b1deeb7791e | |
| parent | 1ff7f04120f11e4d15a6dad40417551873bf8ff2 (diff) | |
Whitelist lints
| -rw-r--r-- | src/librustc_lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/librustc_lint/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 23 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index c5f3b45950e..d6e5c70b8f7 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -280,7 +280,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode { } declare_lint! { - MISSING_DOCS, + pub MISSING_DOCS, Allow, "detects missing documentation for public members" } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index adc700506ff..459f496c9fe 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -56,7 +56,7 @@ use lint::LintId; use lint::FutureIncompatibleInfo; mod bad_style; -mod builtin; +pub mod builtin; mod types; mod unused; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 5cfdd07ab92..c7a8e6804f6 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -189,6 +189,7 @@ 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; let lints = lint::builtin::HardwiredLints.get_lints() .into_iter() .chain(rustc_lint::SoftLints.get_lints().into_iter()) @@ -236,12 +237,22 @@ pub fn run_core(search_paths: SearchPaths, sessopts, cpath, diagnostic_handler, codemap, ); - let shutdown_lints = [lint::builtin::UNUSED_IMPORTS, - lint::builtin::UNUSED_EXTERN_CRATES]; - - for l in &shutdown_lints { - sess.driver_lint_caps.insert(lint::LintId::of(l), lint::Allow); - } + lint::builtin::HardwiredLints.get_lints() + .into_iter() + .chain(rustc_lint::SoftLints.get_lints().into_iter()) + .filter_map(|lint| { + if lint.name == warnings_lint_name || + lint.name == intra_link_resolution_failure_name || + lint.name == missing_docs { + None + } else { + Some(lint) + } + }) + .for_each(|l| { + sess.driver_lint_caps.insert(lint::LintId::of(l), + lint::Allow); + }); let codegen_backend = rustc_driver::get_codegen_backend(&sess); let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); |
