Skip to content

Commit b7f1891

Browse files
phanschflip1995
authored andcommitted
Pluralize disallowed_type lint
This was brought up in [Zulip] and is also mentioned in the lint naming conventions. Since this is still a nursery lint, I think there shouldn't be any problem in renaming it. [Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/disallow_type.20vs.20disallowed-types
1 parent 8dd1bce commit b7f1891

File tree

11 files changed

+60
-49
lines changed

11 files changed

+60
-49
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Current stable, released 2021-10-21
174174

175175
* [`needless_continue`]: Now also lints in `loop { continue; }` case
176176
[#7477](https://github.com/rust-lang/rust-clippy/pull/7477)
177-
* [`disallowed_type`]: Now also primitive types can be disallowed
177+
* [`disallowed_types`]: Now also primitive types can be disallowed
178178
[#7488](https://github.com/rust-lang/rust-clippy/pull/7488)
179179
* [`manual_swap`]: Now also lints on xor swaps
180180
[#7506](https://github.com/rust-lang/rust-clippy/pull/7506)
@@ -248,7 +248,7 @@ Released 2021-09-09
248248
[#7403](https://github.com/rust-lang/rust-clippy/pull/7403)
249249
* [`disallowed_script_idents`]
250250
[#7400](https://github.com/rust-lang/rust-clippy/pull/7400)
251-
* [`disallowed_type`]
251+
* [`disallowed_types`]
252252
[#7315](https://github.com/rust-lang/rust-clippy/pull/7315)
253253
* [`missing_enforced_import_renames`]
254254
[#7300](https://github.com/rust-lang/rust-clippy/pull/7300)
@@ -294,7 +294,7 @@ Released 2021-09-09
294294
[#7379](https://github.com/rust-lang/rust-clippy/pull/7379)
295295
* [`redundant_closure`]: Suggests `&mut` for `FnMut`
296296
[#7437](https://github.com/rust-lang/rust-clippy/pull/7437)
297-
* [`disallowed_method`], [`disallowed_type`]: The configuration values `disallowed-method` and `disallowed-type`
297+
* [`disallowed_method`], [`disallowed_types`]: The configuration values `disallowed-method` and `disallowed-type`
298298
no longer require fully qualified paths
299299
[#7345](https://github.com/rust-lang/rust-clippy/pull/7345)
300300
* [`zst_offset`]: Fixed lint invocation after it was accidentally suppressed
@@ -2823,7 +2823,7 @@ Released 2018-09-13
28232823
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
28242824
[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method
28252825
[`disallowed_script_idents`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_script_idents
2826-
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
2826+
[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
28272827
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
28282828
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
28292829
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons

clippy_lints/src/disallowed_type.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ declare_clippy_lint! {
4343
/// use std::collections::HashMap;
4444
/// ```
4545
#[clippy::version = "1.55.0"]
46-
pub DISALLOWED_TYPE,
46+
pub DISALLOWED_TYPES,
4747
nursery,
48-
"use of a disallowed type"
48+
"use of disallowed types"
4949
}
5050
#[derive(Clone, Debug)]
51-
pub struct DisallowedType {
51+
pub struct DisallowedTypes {
5252
conf_disallowed: Vec<conf::DisallowedType>,
5353
def_ids: FxHashMap<DefId, Option<String>>,
5454
prim_tys: FxHashMap<PrimTy, Option<String>>,
5555
}
5656

57-
impl DisallowedType {
57+
impl DisallowedTypes {
5858
pub fn new(conf_disallowed: Vec<conf::DisallowedType>) -> Self {
5959
Self {
6060
conf_disallowed,
@@ -80,9 +80,9 @@ impl DisallowedType {
8080
}
8181
}
8282

83-
impl_lint_pass!(DisallowedType => [DISALLOWED_TYPE]);
83+
impl_lint_pass!(DisallowedTypes => [DISALLOWED_TYPES]);
8484

85-
impl<'tcx> LateLintPass<'tcx> for DisallowedType {
85+
impl<'tcx> LateLintPass<'tcx> for DisallowedTypes {
8686
fn check_crate(&mut self, cx: &LateContext<'_>) {
8787
for conf in &self.conf_disallowed {
8888
let (path, reason) = match conf {
@@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedType {
125125
fn emit(cx: &LateContext<'_>, name: &str, span: Span, reason: Option<&str>) {
126126
span_lint_and_then(
127127
cx,
128-
DISALLOWED_TYPE,
128+
DISALLOWED_TYPES,
129129
span,
130130
&format!("`{}` is not allowed according to config", name),
131131
|diag| {

clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ store.register_lints(&[
9999
derive::UNSAFE_DERIVE_DESERIALIZE,
100100
disallowed_method::DISALLOWED_METHOD,
101101
disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS,
102-
disallowed_type::DISALLOWED_TYPE,
102+
disallowed_type::DISALLOWED_TYPES,
103103
doc::DOC_MARKDOWN,
104104
doc::MISSING_ERRORS_DOC,
105105
doc::MISSING_PANICS_DOC,

clippy_lints/src/lib.register_nursery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
77
LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY),
88
LintId::of(copies::BRANCHES_SHARING_CODE),
99
LintId::of(disallowed_method::DISALLOWED_METHOD),
10-
LintId::of(disallowed_type::DISALLOWED_TYPE),
10+
LintId::of(disallowed_type::DISALLOWED_TYPES),
1111
LintId::of(equatable_if_let::EQUATABLE_IF_LET),
1212
LintId::of(fallible_impl_from::FALLIBLE_IMPL_FROM),
1313
LintId::of(floating_point_arithmetic::IMPRECISE_FLOPS),

clippy_lints/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
827827
store.register_early_pass(move || Box::new(module_style::ModStyle));
828828
store.register_late_pass(|| Box::new(unused_async::UnusedAsync));
829829
let disallowed_types = conf.disallowed_types.clone();
830-
store.register_late_pass(move || Box::new(disallowed_type::DisallowedType::new(disallowed_types.clone())));
830+
store.register_late_pass(move || Box::new(disallowed_type::DisallowedTypes::new(disallowed_types.clone())));
831831
let import_renames = conf.enforced_import_renames.clone();
832832
store.register_late_pass(move || {
833833
Box::new(missing_enforced_import_rename::ImportRename::new(
@@ -924,6 +924,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
924924
ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters");
925925
ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str");
926926
ls.register_renamed("clippy::if_let_some_result", "clippy::match_result_ok");
927+
ls.register_renamed("clippy::disallowed_type", "clippy::disallowed_types");
927928

928929
// uplifted lints
929930
ls.register_renamed("clippy::invalid_ref", "invalid_value");

clippy_lints/src/utils/conf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub enum DisallowedMethod {
2323
WithReason { path: String, reason: Option<String> },
2424
}
2525

26-
/// A single disallowed type, used by the `DISALLOWED_TYPE` lint.
26+
/// A single disallowed type, used by the `DISALLOWED_TYPES` lint.
2727
#[derive(Clone, Debug, Deserialize)]
2828
#[serde(untagged)]
2929
pub enum DisallowedType {
@@ -260,7 +260,7 @@ define_Conf! {
260260
///
261261
/// The list of disallowed methods, written as fully qualified paths.
262262
(disallowed_methods: Vec<crate::utils::conf::DisallowedMethod> = Vec::new()),
263-
/// Lint: DISALLOWED_TYPE.
263+
/// Lint: DISALLOWED_TYPES.
264264
///
265265
/// The list of disallowed types, written as fully qualified paths.
266266
(disallowed_types: Vec<crate::utils::conf::DisallowedType> = Vec::new()),

tests/ui-toml/toml_disallowed_type/conf_disallowed_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::disallowed_type)]
1+
#![warn(clippy::disallowed_types)]
22

33
extern crate quote;
44
extern crate syn;

tests/ui-toml/toml_disallowed_type/conf_disallowed_type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: `std::sync::atomic::AtomicU32` is not allowed according to config
44
LL | use std::sync::atomic::AtomicU32;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::disallowed-type` implied by `-D warnings`
7+
= note: `-D clippy::disallowed-types` implied by `-D warnings`
88

99
error: `std::time::Instant` is not allowed according to config
1010
--> $DIR/conf_disallowed_type.rs:8:1

tests/ui/rename.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#![allow(clippy::invisible_characters)]
1818
#![allow(clippy::single_char_add_str)]
1919
#![allow(clippy::match_result_ok)]
20+
#![allow(clippy::disallowed_types)]
2021
// uplifted lints
2122
#![allow(invalid_value)]
2223
#![allow(array_into_iter)]
@@ -49,6 +50,7 @@
4950
#![warn(clippy::invisible_characters)]
5051
#![warn(clippy::single_char_add_str)]
5152
#![warn(clippy::match_result_ok)]
53+
#![warn(clippy::disallowed_types)]
5254
// uplifted lints
5355
#![warn(invalid_value)]
5456
#![warn(array_into_iter)]

tests/ui/rename.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#![allow(clippy::invisible_characters)]
1818
#![allow(clippy::single_char_add_str)]
1919
#![allow(clippy::match_result_ok)]
20+
#![allow(clippy::disallowed_types)]
2021
// uplifted lints
2122
#![allow(invalid_value)]
2223
#![allow(array_into_iter)]
@@ -49,6 +50,7 @@
4950
#![warn(clippy::zero_width_space)]
5051
#![warn(clippy::single_char_push_str)]
5152
#![warn(clippy::if_let_some_result)]
53+
#![warn(clippy::disallowed_type)]
5254
// uplifted lints
5355
#![warn(clippy::invalid_ref)]
5456
#![warn(clippy::into_iter_on_array)]

0 commit comments

Comments
 (0)