Skip to content

Commit

Permalink
Whitelist lints
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 5, 2018
1 parent 1ff7f04 commit 92cda8c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc_lint/builtin.rs
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/lib.rs
Expand Up @@ -56,7 +56,7 @@ use lint::LintId;
use lint::FutureIncompatibleInfo;

mod bad_style;
mod builtin;
pub mod builtin;
mod types;
mod unused;

Expand Down
23 changes: 17 additions & 6 deletions src/librustdoc/core.rs
Expand Up @@ -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())
Expand Down Expand Up @@ -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()));
Expand Down

0 comments on commit 92cda8c

Please sign in to comment.