Skip to content

Commit 37254a3

Browse files
author
Andras Mocsary
committed
Move away form blacklist terminology
1 parent 3337f79 commit 37254a3

36 files changed

+99
-99
lines changed

CHANGELOG.md

+2-2
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

+1-1
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

+13-13
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

+6-6
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;
@@ -492,7 +492,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
492492
&bit_mask::BAD_BIT_MASK,
493493
&bit_mask::INEFFECTIVE_BIT_MASK,
494494
&bit_mask::VERBOSE_BIT_MASK,
495-
&blacklisted_name::BLACKLISTED_NAME,
495+
&disallowed_name::DISALLOWED_NAME,
496496
&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
497497
&booleans::LOGIC_BUG,
498498
&booleans::NONMINIMAL_BOOL,
@@ -948,8 +948,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
948948
store.register_late_pass(|| box swap::Swap);
949949
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
950950
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
951-
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
952-
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
951+
let disallowed_names = conf.disallowed_names.iter().cloned().collect::<FxHashSet<_>>();
952+
store.register_late_pass(move || box disallowed_name::DisAllowedName::new(disallowed_names.clone()));
953953
let too_many_arguments_threshold1 = conf.too_many_arguments_threshold;
954954
let too_many_lines_threshold2 = conf.too_many_lines_threshold;
955955
store.register_late_pass(move || box functions::Functions::new(too_many_arguments_threshold1, too_many_lines_threshold2));
@@ -1227,7 +1227,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12271227
LintId::of(&bit_mask::BAD_BIT_MASK),
12281228
LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
12291229
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1230-
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1230+
LintId::of(&disallowed_name::DISALLOWED_NAME),
12311231
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
12321232
LintId::of(&booleans::LOGIC_BUG),
12331233
LintId::of(&booleans::NONMINIMAL_BOOL),
@@ -1480,7 +1480,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14801480
LintId::of(&attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
14811481
LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
14821482
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
1483-
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
1483+
LintId::of(&disallowed_name::DISALLOWED_NAME),
14841484
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
14851485
LintId::of(&collapsible_if::COLLAPSIBLE_IF),
14861486
LintId::of(&comparison_chain::COMPARISON_CHAIN),

clippy_lints/src/utils/conf.rs

+2-2
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

+3-3
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",
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
blacklisted-names = 42
1+
disallowed-names = 42
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() {}
+1-1
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

+1-1
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

tests/ui-toml/toml_blacklist/conf_french_blacklisted_name.stderr

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
error: use of a blacklisted/placeholder name `toto`
2-
--> $DIR/conf_french_blacklisted_name.rs:6:9
1+
error: use of a disallowed/placeholder name `toto`
2+
--> $DIR/conf_french_disallowed_name.rs:6:9
33
|
44
LL | fn test(toto: ()) {}
55
| ^^^^
66
|
7-
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
7+
= note: `-D clippy::disallowed-name` implied by `-D warnings`
88

9-
error: use of a blacklisted/placeholder name `toto`
10-
--> $DIR/conf_french_blacklisted_name.rs:9:9
9+
error: use of a disallowed/placeholder name `toto`
10+
--> $DIR/conf_french_disallowed_name.rs:9:9
1111
|
1212
LL | let toto = 42;
1313
| ^^^^
1414

15-
error: use of a blacklisted/placeholder name `tata`
16-
--> $DIR/conf_french_blacklisted_name.rs:10:9
15+
error: use of a disallowed/placeholder name `tata`
16+
--> $DIR/conf_french_disallowed_name.rs:10:9
1717
|
1818
LL | let tata = 42;
1919
| ^^^^
2020

21-
error: use of a blacklisted/placeholder name `titi`
22-
--> $DIR/conf_french_blacklisted_name.rs:11:9
21+
error: use of a disallowed/placeholder name `titi`
22+
--> $DIR/conf_french_disallowed_name.rs:11:9
2323
|
2424
LL | let titi = 42;
2525
| ^^^^
2626

27-
error: use of a blacklisted/placeholder name `toto`
28-
--> $DIR/conf_french_blacklisted_name.rs:17:10
27+
error: use of a disallowed/placeholder name `toto`
28+
--> $DIR/conf_french_disallowed_name.rs:17:10
2929
|
3030
LL | (toto, Some(tata), titi @ Some(_)) => (),
3131
| ^^^^
3232

33-
error: use of a blacklisted/placeholder name `tata`
34-
--> $DIR/conf_french_blacklisted_name.rs:17:21
33+
error: use of a disallowed/placeholder name `tata`
34+
--> $DIR/conf_french_disallowed_name.rs:17:21
3535
|
3636
LL | (toto, Some(tata), titi @ Some(_)) => (),
3737
| ^^^^
3838

39-
error: use of a blacklisted/placeholder name `titi`
40-
--> $DIR/conf_french_blacklisted_name.rs:17:28
39+
error: use of a disallowed/placeholder name `titi`
40+
--> $DIR/conf_french_disallowed_name.rs:17:28
4141
|
4242
LL | (toto, Some(tata), titi @ Some(_)) => (),
4343
| ^^^^
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown field `foobar`, expected one of `blacklisted-names`, `cognitive-complexity-threshold`, `cyclomatic-complexity-threshold`, `doc-valid-idents`, `too-many-arguments-threshold`, `type-complexity-threshold`, `single-char-binding-names-threshold`, `too-large-for-stack`, `enum-variant-name-threshold`, `enum-variant-size-threshold`, `verbose-bit-mask-threshold`, `literal-representation-threshold`, `trivial-copy-size-limit`, `too-many-lines-threshold`, `array-size-threshold`, `vec-box-size-threshold`, `max-trait-bounds`, `max-struct-bools`, `max-fn-params-bools`, `warn-on-all-wildcard-imports`, `third-party` at line 5 column 1
1+
error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown field `foobar`, expected one of `disallowed-names`, `cognitive-complexity-threshold`, `cyclomatic-complexity-threshold`, `doc-valid-idents`, `too-many-arguments-threshold`, `type-complexity-threshold`, `single-char-binding-names-threshold`, `too-large-for-stack`, `enum-variant-name-threshold`, `enum-variant-size-threshold`, `verbose-bit-mask-threshold`, `literal-representation-threshold`, `trivial-copy-size-limit`, `too-many-lines-threshold`, `array-size-threshold`, `vec-box-size-threshold`, `max-trait-bounds`, `max-struct-bools`, `max-fn-params-bools`, `warn-on-all-wildcard-imports`, `third-party` at line 5 column 1
22

33
error: aborting due to previous error
44

tests/ui/blacklisted_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
unused_mut,
77
unused_variables
88
)]
9-
#![warn(clippy::blacklisted_name)]
9+
#![warn(clippy::disallowed_name)]
1010

1111
fn test(foo: ()) {}
1212

tests/ui/blacklisted_name.stderr

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
1-
error: use of a blacklisted/placeholder name `foo`
2-
--> $DIR/blacklisted_name.rs:11:9
1+
error: use of a disallowed/placeholder name `foo`
2+
--> $DIR/disallowed_name.rs:11:9
33
|
44
LL | fn test(foo: ()) {}
55
| ^^^
66
|
7-
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
7+
= note: `-D clippy::disallowed-name` implied by `-D warnings`
88

9-
error: use of a blacklisted/placeholder name `foo`
10-
--> $DIR/blacklisted_name.rs:14:9
9+
error: use of a disallowed/placeholder name `foo`
10+
--> $DIR/disallowed_name.rs:14:9
1111
|
1212
LL | let foo = 42;
1313
| ^^^
1414

15-
error: use of a blacklisted/placeholder name `baz`
16-
--> $DIR/blacklisted_name.rs:15:9
15+
error: use of a disallowed/placeholder name `baz`
16+
--> $DIR/disallowed_name.rs:15:9
1717
|
1818
LL | let baz = 42;
1919
| ^^^
2020

21-
error: use of a blacklisted/placeholder name `quux`
22-
--> $DIR/blacklisted_name.rs:16:9
21+
error: use of a disallowed/placeholder name `quux`
22+
--> $DIR/disallowed_name.rs:16:9
2323
|
2424
LL | let quux = 42;
2525
| ^^^^
2626

27-
error: use of a blacklisted/placeholder name `foo`
28-
--> $DIR/blacklisted_name.rs:27:10
27+
error: use of a disallowed/placeholder name `foo`
28+
--> $DIR/disallowed_name.rs:27:10
2929
|
3030
LL | (foo, Some(baz), quux @ Some(_)) => (),
3131
| ^^^
3232

33-
error: use of a blacklisted/placeholder name `baz`
34-
--> $DIR/blacklisted_name.rs:27:20
33+
error: use of a disallowed/placeholder name `baz`
34+
--> $DIR/disallowed_name.rs:27:20
3535
|
3636
LL | (foo, Some(baz), quux @ Some(_)) => (),
3737
| ^^^
3838

39-
error: use of a blacklisted/placeholder name `quux`
40-
--> $DIR/blacklisted_name.rs:27:26
39+
error: use of a disallowed/placeholder name `quux`
40+
--> $DIR/disallowed_name.rs:27:26
4141
|
4242
LL | (foo, Some(baz), quux @ Some(_)) => (),
4343
| ^^^^
4444

45-
error: use of a blacklisted/placeholder name `foo`
46-
--> $DIR/blacklisted_name.rs:32:19
45+
error: use of a disallowed/placeholder name `foo`
46+
--> $DIR/disallowed_name.rs:32:19
4747
|
4848
LL | fn issue_1647(mut foo: u8) {
4949
| ^^^
5050

51-
error: use of a blacklisted/placeholder name `baz`
52-
--> $DIR/blacklisted_name.rs:33:13
51+
error: use of a disallowed/placeholder name `baz`
52+
--> $DIR/disallowed_name.rs:33:13
5353
|
5454
LL | let mut baz = 0;
5555
| ^^^
5656

57-
error: use of a blacklisted/placeholder name `quux`
58-
--> $DIR/blacklisted_name.rs:34:21
57+
error: use of a disallowed/placeholder name `quux`
58+
--> $DIR/disallowed_name.rs:34:21
5959
|
6060
LL | if let Some(mut quux) = Some(42) {}
6161
| ^^^^
6262

63-
error: use of a blacklisted/placeholder name `baz`
64-
--> $DIR/blacklisted_name.rs:38:13
63+
error: use of a disallowed/placeholder name `baz`
64+
--> $DIR/disallowed_name.rs:38:13
6565
|
6666
LL | let ref baz = 0;
6767
| ^^^
6868

69-
error: use of a blacklisted/placeholder name `quux`
70-
--> $DIR/blacklisted_name.rs:39:21
69+
error: use of a disallowed/placeholder name `quux`
70+
--> $DIR/disallowed_name.rs:39:21
7171
|
7272
LL | if let Some(ref quux) = Some(42) {}
7373
| ^^^^
7474

75-
error: use of a blacklisted/placeholder name `baz`
76-
--> $DIR/blacklisted_name.rs:43:17
75+
error: use of a disallowed/placeholder name `baz`
76+
--> $DIR/disallowed_name.rs:43:17
7777
|
7878
LL | let ref mut baz = 0;
7979
| ^^^
8080

81-
error: use of a blacklisted/placeholder name `quux`
82-
--> $DIR/blacklisted_name.rs:44:25
81+
error: use of a disallowed/placeholder name `quux`
82+
--> $DIR/disallowed_name.rs:44:25
8383
|
8484
LL | if let Some(ref mut quux) = Some(42) {}
8585
| ^^^^

tests/ui/borrow_box.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![deny(clippy::borrowed_box)]
2-
#![allow(clippy::blacklisted_name)]
2+
#![allow(clippy::disallowed_name)]
33
#![allow(unused_variables)]
44
#![allow(dead_code)]
55

tests/ui/box_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![warn(clippy::all)]
22
#![allow(clippy::boxed_local, clippy::needless_pass_by_value)]
3-
#![allow(clippy::blacklisted_name)]
3+
#![allow(clippy::disallowed_name)]
44

55
macro_rules! boxit {
66
($init:expr, $x:ty) => {

tests/ui/crashes/ice-2760.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![allow(
44
unused_variables,
5-
clippy::blacklisted_name,
5+
clippy::disallowed_name,
66
clippy::needless_pass_by_value,
77
dead_code
88
)]

tests/ui/crashes/ice-3462.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
22

33
#![warn(clippy::all)]
4-
#![allow(clippy::blacklisted_name)]
4+
#![allow(clippy::disallowed_name)]
55
#![allow(unused)]
66

77
/// Test for https://github.com/rust-lang/rust-clippy/issues/3462

0 commit comments

Comments
 (0)