Skip to content

Commit 92cda8c

Browse files
Whitelist lints
1 parent 1ff7f04 commit 92cda8c

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/librustc_lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode {
280280
}
281281

282282
declare_lint! {
283-
MISSING_DOCS,
283+
pub MISSING_DOCS,
284284
Allow,
285285
"detects missing documentation for public members"
286286
}

src/librustc_lint/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use lint::LintId;
5656
use lint::FutureIncompatibleInfo;
5757

5858
mod bad_style;
59-
mod builtin;
59+
pub mod builtin;
6060
mod types;
6161
mod unused;
6262

src/librustdoc/core.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ pub fn run_core(search_paths: SearchPaths,
189189

190190
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
191191
let warnings_lint_name = lint::builtin::WARNINGS.name;
192+
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
192193
let lints = lint::builtin::HardwiredLints.get_lints()
193194
.into_iter()
194195
.chain(rustc_lint::SoftLints.get_lints().into_iter())
@@ -236,12 +237,22 @@ pub fn run_core(search_paths: SearchPaths,
236237
sessopts, cpath, diagnostic_handler, codemap,
237238
);
238239

239-
let shutdown_lints = [lint::builtin::UNUSED_IMPORTS,
240-
lint::builtin::UNUSED_EXTERN_CRATES];
241-
242-
for l in &shutdown_lints {
243-
sess.driver_lint_caps.insert(lint::LintId::of(l), lint::Allow);
244-
}
240+
lint::builtin::HardwiredLints.get_lints()
241+
.into_iter()
242+
.chain(rustc_lint::SoftLints.get_lints().into_iter())
243+
.filter_map(|lint| {
244+
if lint.name == warnings_lint_name ||
245+
lint.name == intra_link_resolution_failure_name ||
246+
lint.name == missing_docs {
247+
None
248+
} else {
249+
Some(lint)
250+
}
251+
})
252+
.for_each(|l| {
253+
sess.driver_lint_caps.insert(lint::LintId::of(l),
254+
lint::Allow);
255+
});
245256

246257
let codegen_backend = rustc_driver::get_codegen_backend(&sess);
247258
let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader()));

0 commit comments

Comments
 (0)