diff --git a/CHANGELOG.md b/CHANGELOG.md index f6bbcbdad89f..dadf01419f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,7 +70,7 @@ Current beta, release 2021-12-02 [#7560](https://github.com/rust-lang/rust-clippy/pull/7560) * [`unnecessary_unwrap`]: Now also checks for `expect`s [#7584](https://github.com/rust-lang/rust-clippy/pull/7584) -* [`disallowed_method`]: Allow adding a reason that will be displayed with the +* [`disallowed_methods`]: Allow adding a reason that will be displayed with the lint message [#7621](https://github.com/rust-lang/rust-clippy/pull/7621) * [`approx_constant`]: Now checks the MSRV for `LOG10_2` and `LOG2_10` @@ -174,7 +174,7 @@ Current stable, released 2021-10-21 * [`needless_continue`]: Now also lints in `loop { continue; }` case [#7477](https://github.com/rust-lang/rust-clippy/pull/7477) -* [`disallowed_type`]: Now also primitive types can be disallowed +* [`disallowed_types`]: Now also primitive types can be disallowed [#7488](https://github.com/rust-lang/rust-clippy/pull/7488) * [`manual_swap`]: Now also lints on xor swaps [#7506](https://github.com/rust-lang/rust-clippy/pull/7506) @@ -248,7 +248,7 @@ Released 2021-09-09 [#7403](https://github.com/rust-lang/rust-clippy/pull/7403) * [`disallowed_script_idents`] [#7400](https://github.com/rust-lang/rust-clippy/pull/7400) -* [`disallowed_type`] +* [`disallowed_types`] [#7315](https://github.com/rust-lang/rust-clippy/pull/7315) * [`missing_enforced_import_renames`] [#7300](https://github.com/rust-lang/rust-clippy/pull/7300) @@ -294,7 +294,7 @@ Released 2021-09-09 [#7379](https://github.com/rust-lang/rust-clippy/pull/7379) * [`redundant_closure`]: Suggests `&mut` for `FnMut` [#7437](https://github.com/rust-lang/rust-clippy/pull/7437) -* [`disallowed_method`], [`disallowed_type`]: The configuration values `disallowed-method` and `disallowed-type` +* [`disallowed_methods`], [`disallowed_types`]: The configuration values `disallowed-method` and `disallowed-type` no longer require fully qualified paths [#7345](https://github.com/rust-lang/rust-clippy/pull/7345) * [`zst_offset`]: Fixed lint invocation after it was accidentally suppressed @@ -703,7 +703,7 @@ Released 2021-05-06 ### Enhancements -* [`disallowed_method`]: Now supports functions in addition to methods +* [`disallowed_methods`]: Now supports functions in addition to methods [#6674](https://github.com/rust-lang/rust-clippy/pull/6674) * [`upper_case_acronyms`]: Added a new configuration `upper-case-acronyms-aggressive` to trigger the lint if there is more than one uppercase character next to each other @@ -1044,7 +1044,7 @@ Released 2020-12-31 * [`field_reassign_with_default`] [#5911](https://github.com/rust-lang/rust-clippy/pull/5911) * [`await_holding_refcell_ref`] [#6029](https://github.com/rust-lang/rust-clippy/pull/6029) -* [`disallowed_method`] [#6081](https://github.com/rust-lang/rust-clippy/pull/6081) +* [`disallowed_methods`] [#6081](https://github.com/rust-lang/rust-clippy/pull/6081) * [`inline_asm_x86_att_syntax`] [#6092](https://github.com/rust-lang/rust-clippy/pull/6092) * [`inline_asm_x86_intel_syntax`] [#6092](https://github.com/rust-lang/rust-clippy/pull/6092) * [`from_iter_instead_of_collect`] [#6101](https://github.com/rust-lang/rust-clippy/pull/6101) @@ -2821,9 +2821,9 @@ Released 2018-09-13 [`derivable_impls`]: https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls [`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq [`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord -[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method +[`disallowed_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods [`disallowed_script_idents`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_script_idents -[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type +[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types [`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression [`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown [`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons diff --git a/clippy_lints/src/disallowed_method.rs b/clippy_lints/src/disallowed_methods.rs similarity index 92% rename from clippy_lints/src/disallowed_method.rs rename to clippy_lints/src/disallowed_methods.rs index c2217353b323..6d4065907fb4 100644 --- a/clippy_lints/src/disallowed_method.rs +++ b/clippy_lints/src/disallowed_methods.rs @@ -48,18 +48,18 @@ declare_clippy_lint! { /// xs.push(123); // Vec::push is _not_ disallowed in the config. /// ``` #[clippy::version = "1.49.0"] - pub DISALLOWED_METHOD, + pub DISALLOWED_METHODS, nursery, "use of a disallowed method call" } #[derive(Clone, Debug)] -pub struct DisallowedMethod { +pub struct DisallowedMethods { conf_disallowed: Vec, disallowed: DefIdMap>, } -impl DisallowedMethod { +impl DisallowedMethods { pub fn new(conf_disallowed: Vec) -> Self { Self { conf_disallowed, @@ -68,9 +68,9 @@ impl DisallowedMethod { } } -impl_lint_pass!(DisallowedMethod => [DISALLOWED_METHOD]); +impl_lint_pass!(DisallowedMethods => [DISALLOWED_METHODS]); -impl<'tcx> LateLintPass<'tcx> for DisallowedMethod { +impl<'tcx> LateLintPass<'tcx> for DisallowedMethods { fn check_crate(&mut self, cx: &LateContext<'_>) { for conf in &self.conf_disallowed { let (path, reason) = match conf { @@ -98,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedMethod { }; let func_path = cx.tcx.def_path_str(def_id); let msg = format!("use of a disallowed method `{}`", func_path); - span_lint_and_then(cx, DISALLOWED_METHOD, expr.span, &msg, |diag| { + span_lint_and_then(cx, DISALLOWED_METHODS, expr.span, &msg, |diag| { if let Some(reason) = reason { diag.note(reason); } diff --git a/clippy_lints/src/disallowed_type.rs b/clippy_lints/src/disallowed_types.rs similarity index 94% rename from clippy_lints/src/disallowed_type.rs rename to clippy_lints/src/disallowed_types.rs index 7e784ca22449..eaed40327136 100644 --- a/clippy_lints/src/disallowed_type.rs +++ b/clippy_lints/src/disallowed_types.rs @@ -43,18 +43,18 @@ declare_clippy_lint! { /// use std::collections::HashMap; /// ``` #[clippy::version = "1.55.0"] - pub DISALLOWED_TYPE, + pub DISALLOWED_TYPES, nursery, - "use of a disallowed type" + "use of disallowed types" } #[derive(Clone, Debug)] -pub struct DisallowedType { +pub struct DisallowedTypes { conf_disallowed: Vec, def_ids: FxHashMap>, prim_tys: FxHashMap>, } -impl DisallowedType { +impl DisallowedTypes { pub fn new(conf_disallowed: Vec) -> Self { Self { conf_disallowed, @@ -80,9 +80,9 @@ impl DisallowedType { } } -impl_lint_pass!(DisallowedType => [DISALLOWED_TYPE]); +impl_lint_pass!(DisallowedTypes => [DISALLOWED_TYPES]); -impl<'tcx> LateLintPass<'tcx> for DisallowedType { +impl<'tcx> LateLintPass<'tcx> for DisallowedTypes { fn check_crate(&mut self, cx: &LateContext<'_>) { for conf in &self.conf_disallowed { let (path, reason) = match conf { @@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedType { fn emit(cx: &LateContext<'_>, name: &str, span: Span, reason: Option<&str>) { span_lint_and_then( cx, - DISALLOWED_TYPE, + DISALLOWED_TYPES, span, &format!("`{}` is not allowed according to config", name), |diag| { diff --git a/clippy_lints/src/lib.register_lints.rs b/clippy_lints/src/lib.register_lints.rs index 4aa0d0f3d8ce..000c72266857 100644 --- a/clippy_lints/src/lib.register_lints.rs +++ b/clippy_lints/src/lib.register_lints.rs @@ -99,9 +99,9 @@ store.register_lints(&[ derive::DERIVE_ORD_XOR_PARTIAL_ORD, derive::EXPL_IMPL_CLONE_ON_COPY, derive::UNSAFE_DERIVE_DESERIALIZE, - disallowed_method::DISALLOWED_METHOD, + disallowed_methods::DISALLOWED_METHODS, disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS, - disallowed_type::DISALLOWED_TYPE, + disallowed_types::DISALLOWED_TYPES, doc::DOC_MARKDOWN, doc::MISSING_ERRORS_DOC, doc::MISSING_PANICS_DOC, diff --git a/clippy_lints/src/lib.register_nursery.rs b/clippy_lints/src/lib.register_nursery.rs index cc0eb71be695..59182fd8175d 100644 --- a/clippy_lints/src/lib.register_nursery.rs +++ b/clippy_lints/src/lib.register_nursery.rs @@ -6,8 +6,8 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![ LintId::of(attrs::EMPTY_LINE_AFTER_OUTER_ATTR), LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY), LintId::of(copies::BRANCHES_SHARING_CODE), - LintId::of(disallowed_method::DISALLOWED_METHOD), - LintId::of(disallowed_type::DISALLOWED_TYPE), + LintId::of(disallowed_methods::DISALLOWED_METHODS), + LintId::of(disallowed_types::DISALLOWED_TYPES), LintId::of(equatable_if_let::EQUATABLE_IF_LET), LintId::of(fallible_impl_from::FALLIBLE_IMPL_FROM), LintId::of(floating_point_arithmetic::IMPRECISE_FLOPS), diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 734aea58d9f1..449fa8a6311a 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -194,9 +194,9 @@ mod default_numeric_fallback; mod dereference; mod derivable_impls; mod derive; -mod disallowed_method; +mod disallowed_methods; mod disallowed_script_idents; -mod disallowed_type; +mod disallowed_types; mod doc; mod double_comparison; mod double_parens; @@ -806,7 +806,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|| Box::new(semicolon_if_nothing_returned::SemicolonIfNothingReturned)); store.register_late_pass(|| Box::new(async_yields_async::AsyncYieldsAsync)); let disallowed_methods = conf.disallowed_methods.clone(); - store.register_late_pass(move || Box::new(disallowed_method::DisallowedMethod::new(disallowed_methods.clone()))); + store.register_late_pass(move || Box::new(disallowed_methods::DisallowedMethods::new(disallowed_methods.clone()))); store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86AttSyntax)); store.register_early_pass(|| Box::new(asm_syntax::InlineAsmX86IntelSyntax)); 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: store.register_early_pass(move || Box::new(module_style::ModStyle)); store.register_late_pass(|| Box::new(unused_async::UnusedAsync)); let disallowed_types = conf.disallowed_types.clone(); - store.register_late_pass(move || Box::new(disallowed_type::DisallowedType::new(disallowed_types.clone()))); + store.register_late_pass(move || Box::new(disallowed_types::DisallowedTypes::new(disallowed_types.clone()))); let import_renames = conf.enforced_import_renames.clone(); store.register_late_pass(move || { Box::new(missing_enforced_import_rename::ImportRename::new( @@ -922,6 +922,8 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) { ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters"); ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str"); ls.register_renamed("clippy::if_let_some_result", "clippy::match_result_ok"); + ls.register_renamed("clippy::disallowed_type", "clippy::disallowed_types"); + ls.register_renamed("clippy::disallowed_method", "clippy::disallowed_methods"); // uplifted lints ls.register_renamed("clippy::invalid_ref", "invalid_value"); diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index 1a1708079805..9c83d30eb9cc 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -15,7 +15,7 @@ pub struct Rename { pub rename: String, } -/// A single disallowed method, used by the `DISALLOWED_METHOD` lint. +/// A single disallowed method, used by the `DISALLOWED_METHODS` lint. #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] pub enum DisallowedMethod { @@ -23,7 +23,7 @@ pub enum DisallowedMethod { WithReason { path: String, reason: Option }, } -/// A single disallowed type, used by the `DISALLOWED_TYPE` lint. +/// A single disallowed type, used by the `DISALLOWED_TYPES` lint. #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] pub enum DisallowedType { @@ -256,11 +256,11 @@ define_Conf! { /// /// Whether to allow certain wildcard imports (prelude, super in tests). (warn_on_all_wildcard_imports: bool = false), - /// Lint: DISALLOWED_METHOD. + /// Lint: DISALLOWED_METHODS. /// /// The list of disallowed methods, written as fully qualified paths. (disallowed_methods: Vec = Vec::new()), - /// Lint: DISALLOWED_TYPE. + /// Lint: DISALLOWED_TYPES. /// /// The list of disallowed types, written as fully qualified paths. (disallowed_types: Vec = Vec::new()), diff --git a/tests/ui-toml/toml_disallowed_method/clippy.toml b/tests/ui-toml/toml_disallowed_methods/clippy.toml similarity index 100% rename from tests/ui-toml/toml_disallowed_method/clippy.toml rename to tests/ui-toml/toml_disallowed_methods/clippy.toml diff --git a/tests/ui-toml/toml_disallowed_method/conf_disallowed_method.rs b/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs similarity index 82% rename from tests/ui-toml/toml_disallowed_method/conf_disallowed_method.rs rename to tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs index 1901a99377ec..cb449b45bde8 100644 --- a/tests/ui-toml/toml_disallowed_method/conf_disallowed_method.rs +++ b/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs @@ -1,4 +1,4 @@ -#![warn(clippy::disallowed_method)] +#![warn(clippy::disallowed_methods)] extern crate regex; use regex::Regex; diff --git a/tests/ui-toml/toml_disallowed_method/conf_disallowed_method.stderr b/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr similarity index 71% rename from tests/ui-toml/toml_disallowed_method/conf_disallowed_method.stderr rename to tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr index 38123220a432..999ead10d518 100644 --- a/tests/ui-toml/toml_disallowed_method/conf_disallowed_method.stderr +++ b/tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.stderr @@ -1,13 +1,13 @@ error: use of a disallowed method `regex::Regex::new` - --> $DIR/conf_disallowed_method.rs:7:14 + --> $DIR/conf_disallowed_methods.rs:7:14 | LL | let re = Regex::new(r"ab.*c").unwrap(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: `-D clippy::disallowed-method` implied by `-D warnings` + = note: `-D clippy::disallowed-methods` implied by `-D warnings` error: use of a disallowed method `regex::Regex::is_match` - --> $DIR/conf_disallowed_method.rs:8:5 + --> $DIR/conf_disallowed_methods.rs:8:5 | LL | re.is_match("abc"); | ^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | re.is_match("abc"); = note: no matching allowed (from clippy.toml) error: use of a disallowed method `std::iter::Iterator::sum` - --> $DIR/conf_disallowed_method.rs:11:5 + --> $DIR/conf_disallowed_methods.rs:11:5 | LL | a.iter().sum::(); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui-toml/toml_disallowed_type/clippy.toml b/tests/ui-toml/toml_disallowed_types/clippy.toml similarity index 100% rename from tests/ui-toml/toml_disallowed_type/clippy.toml rename to tests/ui-toml/toml_disallowed_types/clippy.toml diff --git a/tests/ui-toml/toml_disallowed_type/conf_disallowed_type.rs b/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs similarity index 96% rename from tests/ui-toml/toml_disallowed_type/conf_disallowed_type.rs rename to tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs index 410f07650551..7f28efd676f2 100644 --- a/tests/ui-toml/toml_disallowed_type/conf_disallowed_type.rs +++ b/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.rs @@ -1,4 +1,4 @@ -#![warn(clippy::disallowed_type)] +#![warn(clippy::disallowed_types)] extern crate quote; extern crate syn; diff --git a/tests/ui-toml/toml_disallowed_type/conf_disallowed_type.stderr b/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr similarity index 79% rename from tests/ui-toml/toml_disallowed_type/conf_disallowed_type.stderr rename to tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr index 08a400a83675..e3ece799c7ce 100644 --- a/tests/ui-toml/toml_disallowed_type/conf_disallowed_type.stderr +++ b/tests/ui-toml/toml_disallowed_types/conf_disallowed_types.stderr @@ -1,67 +1,67 @@ error: `std::sync::atomic::AtomicU32` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:7:1 + --> $DIR/conf_disallowed_types.rs:7:1 | LL | use std::sync::atomic::AtomicU32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D clippy::disallowed-type` implied by `-D warnings` + = note: `-D clippy::disallowed-types` implied by `-D warnings` error: `std::time::Instant` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:8:1 + --> $DIR/conf_disallowed_types.rs:8:1 | LL | use std::time::Instant as Sneaky; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `std::time::Instant` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:12:33 + --> $DIR/conf_disallowed_types.rs:12:33 | LL | fn bad_return_type() -> fn() -> Sneaky { | ^^^^^^ error: `std::time::Instant` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:16:28 + --> $DIR/conf_disallowed_types.rs:16:28 | LL | fn bad_arg_type(_: impl Fn(Sneaky) -> foo::atomic::AtomicU32) {} | ^^^^^^ error: `std::sync::atomic::AtomicU32` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:16:39 + --> $DIR/conf_disallowed_types.rs:16:39 | LL | fn bad_arg_type(_: impl Fn(Sneaky) -> foo::atomic::AtomicU32) {} | ^^^^^^^^^^^^^^^^^^^^^^ error: `std::io::Read` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:18:22 + --> $DIR/conf_disallowed_types.rs:18:22 | LL | fn trait_obj(_: &dyn std::io::Read) {} | ^^^^^^^^^^^^^ error: `usize` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:20:33 + --> $DIR/conf_disallowed_types.rs:20:33 | LL | fn full_and_single_path_prim(_: usize, _: bool) {} | ^^^^^ error: `bool` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:20:43 + --> $DIR/conf_disallowed_types.rs:20:43 | LL | fn full_and_single_path_prim(_: usize, _: bool) {} | ^^^^ error: `usize` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:22:28 + --> $DIR/conf_disallowed_types.rs:22:28 | LL | fn const_generics() {} | ^^^^^ error: `usize` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:24:24 + --> $DIR/conf_disallowed_types.rs:24:24 | LL | struct GenArg([u8; U]); | ^^^^^ error: `std::net::Ipv4Addr` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:28:10 + --> $DIR/conf_disallowed_types.rs:28:10 | LL | fn ip(_: std::net::Ipv4Addr) {} | ^^^^^^^^^^^^^^^^^^ @@ -69,61 +69,61 @@ LL | fn ip(_: std::net::Ipv4Addr) {} = note: no IPv4 allowed (from clippy.toml) error: `std::net::TcpListener` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:30:16 + --> $DIR/conf_disallowed_types.rs:30:16 | LL | fn listener(_: std::net::TcpListener) {} | ^^^^^^^^^^^^^^^^^^^^^ error: `std::collections::HashMap` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:34:48 + --> $DIR/conf_disallowed_types.rs:34:48 | LL | let _: std::collections::HashMap<(), ()> = std::collections::HashMap::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `std::collections::HashMap` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:34:12 + --> $DIR/conf_disallowed_types.rs:34:12 | LL | let _: std::collections::HashMap<(), ()> = std::collections::HashMap::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `std::time::Instant` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:35:13 + --> $DIR/conf_disallowed_types.rs:35:13 | LL | let _ = Sneaky::now(); | ^^^^^^ error: `std::sync::atomic::AtomicU32` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:36:13 + --> $DIR/conf_disallowed_types.rs:36:13 | LL | let _ = foo::atomic::AtomicU32::new(0); | ^^^^^^^^^^^^^^^^^^^^^^ error: `std::sync::atomic::AtomicU32` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:37:17 + --> $DIR/conf_disallowed_types.rs:37:17 | LL | static FOO: std::sync::atomic::AtomicU32 = foo::atomic::AtomicU32::new(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `std::sync::atomic::AtomicU32` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:37:48 + --> $DIR/conf_disallowed_types.rs:37:48 | LL | static FOO: std::sync::atomic::AtomicU32 = foo::atomic::AtomicU32::new(1); | ^^^^^^^^^^^^^^^^^^^^^^ error: `syn::TypePath` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:38:43 + --> $DIR/conf_disallowed_types.rs:38:43 | LL | let _: std::collections::BTreeMap<(), syn::TypePath> = Default::default(); | ^^^^^^^^^^^^^ error: `syn::Ident` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:39:13 + --> $DIR/conf_disallowed_types.rs:39:13 | LL | let _ = syn::Ident::new("", todo!()); | ^^^^^^^^^^ error: `usize` is not allowed according to config - --> $DIR/conf_disallowed_type.rs:41:12 + --> $DIR/conf_disallowed_types.rs:41:12 | LL | let _: usize = 64_usize; | ^^^^^ diff --git a/tests/ui/rename.fixed b/tests/ui/rename.fixed index cc295b509bc5..b9425733a8b2 100644 --- a/tests/ui/rename.fixed +++ b/tests/ui/rename.fixed @@ -6,6 +6,7 @@ #![allow(clippy::module_name_repetitions)] #![allow(clippy::new_without_default)] #![allow(clippy::redundant_static_lifetimes)] +#![allow(clippy::cognitive_complexity)] #![allow(clippy::bind_instead_of_map)] #![allow(clippy::box_collection)] #![allow(clippy::blocks_in_if_conditions)] @@ -17,6 +18,8 @@ #![allow(clippy::invisible_characters)] #![allow(clippy::single_char_add_str)] #![allow(clippy::match_result_ok)] +#![allow(clippy::disallowed_types)] +#![allow(clippy::disallowed_methods)] // uplifted lints #![allow(invalid_value)] #![allow(array_into_iter)] @@ -49,6 +52,8 @@ #![warn(clippy::invisible_characters)] #![warn(clippy::single_char_add_str)] #![warn(clippy::match_result_ok)] +#![warn(clippy::disallowed_types)] +#![warn(clippy::disallowed_methods)] // uplifted lints #![warn(invalid_value)] #![warn(array_into_iter)] diff --git a/tests/ui/rename.rs b/tests/ui/rename.rs index 377075c02464..341c003b9df3 100644 --- a/tests/ui/rename.rs +++ b/tests/ui/rename.rs @@ -6,6 +6,7 @@ #![allow(clippy::module_name_repetitions)] #![allow(clippy::new_without_default)] #![allow(clippy::redundant_static_lifetimes)] +#![allow(clippy::cognitive_complexity)] #![allow(clippy::bind_instead_of_map)] #![allow(clippy::box_collection)] #![allow(clippy::blocks_in_if_conditions)] @@ -17,6 +18,8 @@ #![allow(clippy::invisible_characters)] #![allow(clippy::single_char_add_str)] #![allow(clippy::match_result_ok)] +#![allow(clippy::disallowed_types)] +#![allow(clippy::disallowed_methods)] // uplifted lints #![allow(invalid_value)] #![allow(array_into_iter)] @@ -49,6 +52,8 @@ #![warn(clippy::zero_width_space)] #![warn(clippy::single_char_push_str)] #![warn(clippy::if_let_some_result)] +#![warn(clippy::disallowed_type)] +#![warn(clippy::disallowed_method)] // uplifted lints #![warn(clippy::invalid_ref)] #![warn(clippy::into_iter_on_array)] diff --git a/tests/ui/rename.stderr b/tests/ui/rename.stderr index d720f10d117c..cdec2808f1d4 100644 --- a/tests/ui/rename.stderr +++ b/tests/ui/rename.stderr @@ -1,5 +1,5 @@ error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` - --> $DIR/rename.rs:31:9 + --> $DIR/rename.rs:34:9 | LL | #![warn(clippy::stutter)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` @@ -7,178 +7,190 @@ LL | #![warn(clippy::stutter)] = note: `-D renamed-and-removed-lints` implied by `-D warnings` error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default` - --> $DIR/rename.rs:32:9 + --> $DIR/rename.rs:35:9 | LL | #![warn(clippy::new_without_default_derive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes` - --> $DIR/rename.rs:33:9 + --> $DIR/rename.rs:36:9 | LL | #![warn(clippy::const_static_lifetime)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> $DIR/rename.rs:34:9 + --> $DIR/rename.rs:37:9 | LL | #![warn(clippy::cyclomatic_complexity)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map` - --> $DIR/rename.rs:35:9 + --> $DIR/rename.rs:38:9 | LL | #![warn(clippy::option_and_then_some)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map` error: lint `clippy::box_vec` has been renamed to `clippy::box_collection` - --> $DIR/rename.rs:36:9 + --> $DIR/rename.rs:39:9 | LL | #![warn(clippy::box_vec)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection` error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions` - --> $DIR/rename.rs:37:9 + --> $DIR/rename.rs:40:9 | LL | #![warn(clippy::block_in_if_condition_expr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions` error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions` - --> $DIR/rename.rs:38:9 + --> $DIR/rename.rs:41:9 | LL | #![warn(clippy::block_in_if_condition_stmt)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions` error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:39:9 + --> $DIR/rename.rs:42:9 | LL | #![warn(clippy::option_map_unwrap_or)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:40:9 + --> $DIR/rename.rs:43:9 | LL | #![warn(clippy::option_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:41:9 + --> $DIR/rename.rs:44:9 | LL | #![warn(clippy::result_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used` - --> $DIR/rename.rs:42:9 + --> $DIR/rename.rs:45:9 | LL | #![warn(clippy::option_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used` - --> $DIR/rename.rs:43:9 + --> $DIR/rename.rs:46:9 | LL | #![warn(clippy::result_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used` - --> $DIR/rename.rs:44:9 + --> $DIR/rename.rs:47:9 | LL | #![warn(clippy::option_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used` - --> $DIR/rename.rs:45:9 + --> $DIR/rename.rs:48:9 | LL | #![warn(clippy::result_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::for_loop_over_option` has been renamed to `clippy::for_loops_over_fallibles` - --> $DIR/rename.rs:46:9 + --> $DIR/rename.rs:49:9 | LL | #![warn(clippy::for_loop_over_option)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::for_loops_over_fallibles` error: lint `clippy::for_loop_over_result` has been renamed to `clippy::for_loops_over_fallibles` - --> $DIR/rename.rs:47:9 + --> $DIR/rename.rs:50:9 | LL | #![warn(clippy::for_loop_over_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::for_loops_over_fallibles` error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion` - --> $DIR/rename.rs:48:9 + --> $DIR/rename.rs:51:9 | LL | #![warn(clippy::identity_conversion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion` error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters` - --> $DIR/rename.rs:49:9 + --> $DIR/rename.rs:52:9 | LL | #![warn(clippy::zero_width_space)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters` error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str` - --> $DIR/rename.rs:50:9 + --> $DIR/rename.rs:53:9 | LL | #![warn(clippy::single_char_push_str)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str` error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok` - --> $DIR/rename.rs:51:9 + --> $DIR/rename.rs:54:9 | LL | #![warn(clippy::if_let_some_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok` +error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types` + --> $DIR/rename.rs:55:9 + | +LL | #![warn(clippy::disallowed_type)] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types` + +error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods` + --> $DIR/rename.rs:56:9 + | +LL | #![warn(clippy::disallowed_method)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods` + error: lint `clippy::invalid_ref` has been renamed to `invalid_value` - --> $DIR/rename.rs:53:9 + --> $DIR/rename.rs:58:9 | LL | #![warn(clippy::invalid_ref)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value` error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` - --> $DIR/rename.rs:54:9 + --> $DIR/rename.rs:59:9 | LL | #![warn(clippy::into_iter_on_array)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter` error: lint `clippy::unused_label` has been renamed to `unused_labels` - --> $DIR/rename.rs:55:9 + --> $DIR/rename.rs:60:9 | LL | #![warn(clippy::unused_label)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels` error: lint `clippy::drop_bounds` has been renamed to `drop_bounds` - --> $DIR/rename.rs:56:9 + --> $DIR/rename.rs:61:9 | LL | #![warn(clippy::drop_bounds)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds` error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr` - --> $DIR/rename.rs:57:9 + --> $DIR/rename.rs:62:9 | LL | #![warn(clippy::temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr` error: lint `clippy::panic_params` has been renamed to `non_fmt_panics` - --> $DIR/rename.rs:58:9 + --> $DIR/rename.rs:63:9 | LL | #![warn(clippy::panic_params)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics` error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints` - --> $DIR/rename.rs:59:9 + --> $DIR/rename.rs:64:9 | LL | #![warn(clippy::unknown_clippy_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints` error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering` - --> $DIR/rename.rs:60:9 + --> $DIR/rename.rs:65:9 | LL | #![warn(clippy::invalid_atomic_ordering)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering` error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums` - --> $DIR/rename.rs:61:9 + --> $DIR/rename.rs:66:9 | LL | #![warn(clippy::mem_discriminant_non_enum)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums` -error: aborting due to 30 previous errors +error: aborting due to 32 previous errors