Skip to content

Commit 741a240

Browse files
Andras Mocsarymocsy
authored andcommitted
Move away form blacklist terminology
1 parent 9360ca6 commit 741a240

36 files changed

+99
-99
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Current beta, release 2020-08-27
3939
[#5692](https://github.com/rust-lang/rust-clippy/pull/5692)
4040
* [`if_same_then_else`]: Don't assume multiplication is always commutative
4141
[#5702](https://github.com/rust-lang/rust-clippy/pull/5702)
42-
* [`blacklisted_name`]: Remove `bar` from the default configuration
42+
* [`disallowed_name`]: Remove `bar` from the default configuration
4343
[#5712](https://github.com/rust-lang/rust-clippy/pull/5712)
4444
* [`redundant_pattern_matching`]: Avoid suggesting non-`const fn` calls in const contexts
4545
[#5724](https://github.com/rust-lang/rust-clippy/pull/5724)
@@ -1413,7 +1413,7 @@ Released 2018-09-13
14131413
[`await_holding_lock`]: https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
14141414
[`bad_bit_mask`]: https://rust-lang.github.io/rust-clippy/master/index.html#bad_bit_mask
14151415
[`bind_instead_of_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
1416-
[`blacklisted_name`]: https://rust-lang.github.io/rust-clippy/master/index.html#blacklisted_name
1416+
[`disallowed_name`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_name
14171417
[`blanket_clippy_restriction_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#blanket_clippy_restriction_lints
14181418
[`blocks_in_if_conditions`]: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_if_conditions
14191419
[`bool_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml
143143
value` mapping eg.
144144

145145
```toml
146-
blacklisted-names = ["toto", "tata", "titi"]
146+
disallowed-names = ["toto", "tata", "titi"]
147147
cognitive-complexity-threshold = 30
148148
```
149149

clippy_lints/src/blacklisted_name.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_lint::{LateContext, LateLintPass};
55
use rustc_session::{declare_tool_lint, impl_lint_pass};
66

77
declare_clippy_lint! {
8-
/// **What it does:** Checks for usage of blacklisted names for variables, such
8+
/// **What it does:** Checks for usage of disallowed names for variables, such
99
/// as `foo`.
1010
///
1111
/// **Why is this bad?** These names are usually placeholder names and should be
@@ -17,33 +17,33 @@ declare_clippy_lint! {
1717
/// ```rust
1818
/// let foo = 3.14;
1919
/// ```
20-
pub BLACKLISTED_NAME,
20+
pub DISALLOWED_NAME,
2121
style,
22-
"usage of a blacklisted/placeholder name"
22+
"usage of a disallowed/placeholder name"
2323
}
2424

2525
#[derive(Clone, Debug)]
26-
pub struct BlacklistedName {
27-
blacklist: FxHashSet<String>,
26+
pub struct DisAllowedName {
27+
disallowlist: FxHashSet<String>,
2828
}
2929

30-
impl BlacklistedName {
31-
pub fn new(blacklist: FxHashSet<String>) -> Self {
32-
Self { blacklist }
30+
impl DisAllowedName {
31+
pub fn new(disallowlist: FxHashSet<String>) -> Self {
32+
Self { disallowlist }
3333
}
3434
}
3535

36-
impl_lint_pass!(BlacklistedName => [BLACKLISTED_NAME]);
36+
impl_lint_pass!(DisAllowedName => [DISALLOWED_NAME]);
3737

38-
impl<'tcx> LateLintPass<'tcx> for BlacklistedName {
38+
impl<'tcx> LateLintPass<'tcx> for DisAllowedName {
3939
fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>) {
4040
if let PatKind::Binding(.., ident, _) = pat.kind {
41-
if self.blacklist.contains(&ident.name.to_string()) {
41+
if self.disallowlist.contains(&ident.name.to_string()) {
4242
span_lint(
4343
cx,
44-
BLACKLISTED_NAME,
44+
DISALLOWED_NAME,
4545
ident.span,
46-
&format!("use of a blacklisted/placeholder name `{}`", ident.name),
46+
&format!("use of a disallowed/placeholder name `{}`", ident.name),
4747
);
4848
}
4949
}

clippy_lints/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ mod atomic_ordering;
158158
mod attrs;
159159
mod await_holding_lock;
160160
mod bit_mask;
161-
mod blacklisted_name;
161+
mod disallowed_name;
162162
mod blocks_in_if_conditions;
163163
mod booleans;
164164
mod bytecount;
@@ -494,7 +494,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
494494
&bit_mask::BAD_BIT_MASK,
495495
&bit_mask::INEFFECTIVE_BIT_MASK,
496496
&bit_mask::VERBOSE_BIT_MASK,
497-
&blacklisted_name::BLACKLISTED_NAME,
497+
&disallowed_name::DISALLOWED_NAME,
498498
&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
499499
&booleans::LOGIC_BUG,
500500
&booleans::NONMINIMAL_BOOL,
@@ -954,8 +954,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
954954
store.register_late_pass(|| box swap::Swap);
955955
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
956956
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
957-
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
958-
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
957+
let disallowed_names = conf.disallowed_names.iter().cloned().collect::<FxHashSet<_>>();
958+
store.register_late_pass(move || box disallowed_name::DisAllowedName::new(disallowed_names.clone()));
959959
let too_many_arguments_threshold1 = conf.too_many_arguments_threshold;
960960
let too_many_lines_threshold2 = conf.too_many_lines_threshold;
961961
store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold1, too_many_lines_threshold2));
@@ -1235,7 +1235,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12351235
LintId::of(&bit_mask::BAD_BIT_MASK),
12361236
LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
12371237
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1238-
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1238+
LintId::of(&disallowed_name::DISALLOWED_NAME),
12391239
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
12401240
LintId::of(&booleans::LOGIC_BUG),
12411241
LintId::of(&booleans::NONMINIMAL_BOOL),
@@ -1492,7 +1492,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14921492
LintId::of(&attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
14931493
LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
14941494
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1495-
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1495+
LintId::of(&disallowed_name::DISALLOWED_NAME),
14961496
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
14971497
LintId::of(&collapsible_if::COLLAPSIBLE_IF),
14981498
LintId::of(&comparison_chain::COMPARISON_CHAIN),

clippy_lints/src/utils/conf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ macro_rules! define_Conf {
106106

107107
pub use self::helpers::Conf;
108108
define_Conf! {
109-
/// Lint: BLACKLISTED_NAME. The list of blacklisted names to lint about. NB: `bar` is not here since it has legitimate uses
110-
(blacklisted_names, "blacklisted_names": Vec<String>, ["foo", "baz", "quux"].iter().map(ToString::to_string).collect()),
109+
/// Lint: DISALLOWED_NAME. The list of disallowed names to lint about. NB: `bar` is not here since it has legitimate uses
110+
(disallowed_names, "disallowed_names": Vec<String>, ["foo", "baz", "quux"].iter().map(ToString::to_string).collect()),
111111
/// Lint: COGNITIVE_COMPLEXITY. The maximum cognitive complexity a function can have
112112
(cognitive_complexity_threshold, "cognitive_complexity_threshold": u64, 25),
113113
/// DEPRECATED LINT: CYCLOMATIC_COMPLEXITY. Use the Cognitive Complexity lint instead.

src/lintlist/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
7474
module: "methods",
7575
},
7676
Lint {
77-
name: "blacklisted_name",
77+
name: "disallowed_name",
7878
group: "style",
79-
desc: "usage of a blacklisted/placeholder name",
79+
desc: "usage of a disallowed/placeholder name",
8080
deprecation: None,
81-
module: "blacklisted_name",
81+
module: "disallowed_name",
8282
},
8383
Lint {
8484
name: "blanket_clippy_restriction_lints",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
blacklisted-names = 42
1+
disallowed-names = 42
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: error reading Clippy's configuration file: `blacklisted-names` is expected to be a
1+
// error-pattern: error reading Clippy's configuration file: `disallowed-names` is expected to be a
22
// `Vec < String >` but is a `integer`
33

44
fn main() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
blacklisted-names = ["toto", "tata", "titi"]
1+
disallowed-names = ["toto", "tata", "titi"]

tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(dead_code)]
22
#![allow(clippy::single_match)]
33
#![allow(unused_variables)]
4-
#![warn(clippy::blacklisted_name)]
4+
#![warn(clippy::disallowed_name)]
55

66
fn test(toto: ()) {}
77

0 commit comments

Comments
 (0)