Avoid "whitelist"
Other terms are more inclusive and precise.
This commit is contained in:
committed by
Tamir Duberstein
parent
e59b08e62e
commit
62cf767a4a
@@ -225,7 +225,7 @@ pub fn new_handler(
|
||||
/// * Vector of tuples of lints' name and their associated "max" level
|
||||
/// * HashMap of lint id with their associated "max" level
|
||||
pub fn init_lints<F>(
|
||||
mut whitelisted_lints: Vec<String>,
|
||||
mut allowed_lints: Vec<String>,
|
||||
lint_opts: Vec<(String, lint::Level)>,
|
||||
filter_call: F,
|
||||
) -> (Vec<(String, lint::Level)>, FxHashMap<lint::LintId, lint::Level>)
|
||||
@@ -234,8 +234,8 @@ where
|
||||
{
|
||||
let warnings_lint_name = lint::builtin::WARNINGS.name;
|
||||
|
||||
whitelisted_lints.push(warnings_lint_name.to_owned());
|
||||
whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
|
||||
allowed_lints.push(warnings_lint_name.to_owned());
|
||||
allowed_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
|
||||
|
||||
let lints = || {
|
||||
lint::builtin::HardwiredLints::get_lints()
|
||||
@@ -245,7 +245,7 @@ where
|
||||
|
||||
let lint_opts = lints()
|
||||
.filter_map(|lint| {
|
||||
// Whitelist feature-gated lints to avoid feature errors when trying to
|
||||
// Permit feature-gated lints to avoid feature errors when trying to
|
||||
// allow all lints.
|
||||
if lint.name == warnings_lint_name || lint.feature_gate.is_some() {
|
||||
None
|
||||
@@ -258,9 +258,9 @@ where
|
||||
|
||||
let lint_caps = lints()
|
||||
.filter_map(|lint| {
|
||||
// We don't want to whitelist *all* lints so let's
|
||||
// ignore those ones.
|
||||
if whitelisted_lints.iter().any(|l| lint.name == l) {
|
||||
// We don't want to allow *all* lints so let's ignore
|
||||
// those ones.
|
||||
if allowed_lints.iter().any(|l| lint.name == l) {
|
||||
None
|
||||
} else {
|
||||
Some((lint::LintId::of(lint), lint::Allow))
|
||||
@@ -317,9 +317,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
||||
let no_crate_level_docs = rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS.name;
|
||||
let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name;
|
||||
|
||||
// In addition to those specific lints, we also need to whitelist those given through
|
||||
// In addition to those specific lints, we also need to allow those given through
|
||||
// command line, otherwise they'll get ignored and we don't want that.
|
||||
let whitelisted_lints = vec![
|
||||
let allowed_lints = vec![
|
||||
intra_link_resolution_failure_name.to_owned(),
|
||||
missing_docs.to_owned(),
|
||||
missing_doc_example.to_owned(),
|
||||
@@ -328,7 +328,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
||||
invalid_codeblock_attribute_name.to_owned(),
|
||||
];
|
||||
|
||||
let (lint_opts, lint_caps) = init_lints(whitelisted_lints, lint_opts, |lint| {
|
||||
let (lint_opts, lint_caps) = init_lints(allowed_lints, lint_opts, |lint| {
|
||||
if lint.name == intra_link_resolution_failure_name
|
||||
|| lint.name == invalid_codeblock_attribute_name
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user