Skip to content

Commit 38bd251

Browse files
committed
Auto merge of rust-lang#7984 - phansch:disallowed-type-rename, r=xFrednet
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]: rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/disallow_type.20vs.20disallowed-types changelog: Rename nursery lint [`disallowed_type`] to [`disallowed_types`].
2 parents 0d283cc + 9b38fb7 commit 38bd251

16 files changed

+116
-92
lines changed

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Current beta, release 2021-12-02
7070
[#7560](https://github.com/rust-lang/rust-clippy/pull/7560)
7171
* [`unnecessary_unwrap`]: Now also checks for `expect`s
7272
[#7584](https://github.com/rust-lang/rust-clippy/pull/7584)
73-
* [`disallowed_method`]: Allow adding a reason that will be displayed with the
73+
* [`disallowed_methods`]: Allow adding a reason that will be displayed with the
7474
lint message
7575
[#7621](https://github.com/rust-lang/rust-clippy/pull/7621)
7676
* [`approx_constant`]: Now checks the MSRV for `LOG10_2` and `LOG2_10`
@@ -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_methods`], [`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
@@ -703,7 +703,7 @@ Released 2021-05-06
703703

704704
### Enhancements
705705

706-
* [`disallowed_method`]: Now supports functions in addition to methods
706+
* [`disallowed_methods`]: Now supports functions in addition to methods
707707
[#6674](https://github.com/rust-lang/rust-clippy/pull/6674)
708708
* [`upper_case_acronyms`]: Added a new configuration `upper-case-acronyms-aggressive` to
709709
trigger the lint if there is more than one uppercase character next to each other
@@ -1044,7 +1044,7 @@ Released 2020-12-31
10441044

10451045
* [`field_reassign_with_default`] [#5911](https://github.com/rust-lang/rust-clippy/pull/5911)
10461046
* [`await_holding_refcell_ref`] [#6029](https://github.com/rust-lang/rust-clippy/pull/6029)
1047-
* [`disallowed_method`] [#6081](https://github.com/rust-lang/rust-clippy/pull/6081)
1047+
* [`disallowed_methods`] [#6081](https://github.com/rust-lang/rust-clippy/pull/6081)
10481048
* [`inline_asm_x86_att_syntax`] [#6092](https://github.com/rust-lang/rust-clippy/pull/6092)
10491049
* [`inline_asm_x86_intel_syntax`] [#6092](https://github.com/rust-lang/rust-clippy/pull/6092)
10501050
* [`from_iter_instead_of_collect`] [#6101](https://github.com/rust-lang/rust-clippy/pull/6101)
@@ -2821,9 +2821,9 @@ Released 2018-09-13
28212821
[`derivable_impls`]: https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
28222822
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
28232823
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
2824-
[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method
2824+
[`disallowed_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
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_method.rs renamed to clippy_lints/src/disallowed_methods.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ declare_clippy_lint! {
4848
/// xs.push(123); // Vec::push is _not_ disallowed in the config.
4949
/// ```
5050
#[clippy::version = "1.49.0"]
51-
pub DISALLOWED_METHOD,
51+
pub DISALLOWED_METHODS,
5252
nursery,
5353
"use of a disallowed method call"
5454
}
5555

5656
#[derive(Clone, Debug)]
57-
pub struct DisallowedMethod {
57+
pub struct DisallowedMethods {
5858
conf_disallowed: Vec<conf::DisallowedMethod>,
5959
disallowed: DefIdMap<Option<String>>,
6060
}
6161

62-
impl DisallowedMethod {
62+
impl DisallowedMethods {
6363
pub fn new(conf_disallowed: Vec<conf::DisallowedMethod>) -> Self {
6464
Self {
6565
conf_disallowed,
@@ -68,9 +68,9 @@ impl DisallowedMethod {
6868
}
6969
}
7070

71-
impl_lint_pass!(DisallowedMethod => [DISALLOWED_METHOD]);
71+
impl_lint_pass!(DisallowedMethods => [DISALLOWED_METHODS]);
7272

73-
impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
73+
impl<'tcx> LateLintPass<'tcx> for DisallowedMethods {
7474
fn check_crate(&mut self, cx: &LateContext<'_>) {
7575
for conf in &self.conf_disallowed {
7676
let (path, reason) = match conf {
@@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {
9898
};
9999
let func_path = cx.tcx.def_path_str(def_id);
100100
let msg = format!("use of a disallowed method `{}`", func_path);
101-
span_lint_and_then(cx, DISALLOWED_METHOD, expr.span, &msg, |diag| {
101+
span_lint_and_then(cx, DISALLOWED_METHODS, expr.span, &msg, |diag| {
102102
if let Some(reason) = reason {
103103
diag.note(reason);
104104
}

clippy_lints/src/disallowed_type.rs renamed to clippy_lints/src/disallowed_types.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ store.register_lints(&[
9999
derive::DERIVE_ORD_XOR_PARTIAL_ORD,
100100
derive::EXPL_IMPL_CLONE_ON_COPY,
101101
derive::UNSAFE_DERIVE_DESERIALIZE,
102-
disallowed_method::DISALLOWED_METHOD,
102+
disallowed_methods::DISALLOWED_METHODS,
103103
disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS,
104-
disallowed_type::DISALLOWED_TYPE,
104+
disallowed_types::DISALLOWED_TYPES,
105105
doc::DOC_MARKDOWN,
106106
doc::MISSING_ERRORS_DOC,
107107
doc::MISSING_PANICS_DOC,

clippy_lints/src/lib.register_nursery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
66
LintId::of(attrs::EMPTY_LINE_AFTER_OUTER_ATTR),
77
LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY),
88
LintId::of(copies::BRANCHES_SHARING_CODE),
9-
LintId::of(disallowed_method::DISALLOWED_METHOD),
10-
LintId::of(disallowed_type::DISALLOWED_TYPE),
9+
LintId::of(disallowed_methods::DISALLOWED_METHODS),
10+
LintId::of(disallowed_types::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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ mod default_numeric_fallback;
194194
mod dereference;
195195
mod derivable_impls;
196196
mod derive;
197-
mod disallowed_method;
197+
mod disallowed_methods;
198198
mod disallowed_script_idents;
199-
mod disallowed_type;
199+
mod disallowed_types;
200200
mod doc;
201201
mod double_comparison;
202202
mod double_parens;
@@ -806,7 +806,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
806806
store.register_late_pass(|| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned));
807807
store.register_late_pass(|| Box::new(async_yields_async::AsyncYieldsAsync));
808808
let disallowed_methods = conf.disallowed_methods.clone();
809-
store.register_late_pass(move || Box::new(disallowed_method::DisallowedMethod::new(disallowed_methods.clone())));
809+
store.register_late_pass(move || Box::new(disallowed_methods::DisallowedMethods::new(disallowed_methods.clone())));
810810
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax));
811811
store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax));
812812
store.register_late_pass(|| Box::new(undropped_manually_drops::UndroppedManuallyDrops));
@@ -825,7 +825,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
825825
store.register_early_pass(move || Box::new(module_style::ModStyle));
826826
store.register_late_pass(|| Box::new(unused_async::UnusedAsync));
827827
let disallowed_types = conf.disallowed_types.clone();
828-
store.register_late_pass(move || Box::new(disallowed_type::DisallowedType::new(disallowed_types.clone())));
828+
store.register_late_pass(move || Box::new(disallowed_types::DisallowedTypes::new(disallowed_types.clone())));
829829
let import_renames = conf.enforced_import_renames.clone();
830830
store.register_late_pass(move || {
831831
Box::new(missing_enforced_import_rename::ImportRename::new(
@@ -922,6 +922,8 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
922922
ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters");
923923
ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str");
924924
ls.register_renamed("clippy::if_let_some_result", "clippy::match_result_ok");
925+
ls.register_renamed("clippy::disallowed_type", "clippy::disallowed_types");
926+
ls.register_renamed("clippy::disallowed_method", "clippy::disallowed_methods");
925927

926928
// uplifted lints
927929
ls.register_renamed("clippy::invalid_ref", "invalid_value");

clippy_lints/src/utils/conf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ pub struct Rename {
1515
pub rename: String,
1616
}
1717

18-
/// A single disallowed method, used by the `DISALLOWED_METHOD` lint.
18+
/// A single disallowed method, used by the `DISALLOWED_METHODS` lint.
1919
#[derive(Clone, Debug, Deserialize)]
2020
#[serde(untagged)]
2121
pub enum DisallowedMethod {
2222
Simple(String),
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 {
@@ -256,11 +256,11 @@ define_Conf! {
256256
///
257257
/// Whether to allow certain wildcard imports (prelude, super in tests).
258258
(warn_on_all_wildcard_imports: bool = false),
259-
/// Lint: DISALLOWED_METHOD.
259+
/// Lint: DISALLOWED_METHODS.
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_method/conf_disallowed_method.rs renamed to tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs

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

33
extern crate regex;
44
use regex::Regex;

tests/ui-toml/toml_disallowed_method/conf_disallowed_method.stderr renamed to tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error: use of a disallowed method `regex::Regex::new`
2-
--> $DIR/conf_disallowed_method.rs:7:14
2+
--> $DIR/conf_disallowed_methods.rs:7:14
33
|
44
LL | let re = Regex::new(r"ab.*c").unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::disallowed-method` implied by `-D warnings`
7+
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
88

99
error: use of a disallowed method `regex::Regex::is_match`
10-
--> $DIR/conf_disallowed_method.rs:8:5
10+
--> $DIR/conf_disallowed_methods.rs:8:5
1111
|
1212
LL | re.is_match("abc");
1313
| ^^^^^^^^^^^^^^^^^^
1414
|
1515
= note: no matching allowed (from clippy.toml)
1616

1717
error: use of a disallowed method `std::iter::Iterator::sum`
18-
--> $DIR/conf_disallowed_method.rs:11:5
18+
--> $DIR/conf_disallowed_methods.rs:11:5
1919
|
2020
LL | a.iter().sum::<i32>();
2121
| ^^^^^^^^^^^^^^^^^^^^^

tests/ui-toml/toml_disallowed_type/conf_disallowed_type.rs renamed to tests/ui-toml/toml_disallowed_types/conf_disallowed_types.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;

0 commit comments

Comments
 (0)