diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d971b38bc..db2602285c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4430,6 +4430,7 @@ Released 2018-09-13 [`if_same_then_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [`if_then_some_else_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none [`ifs_same_cond`]: https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond +[`impl_trait_in_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#impl_trait_in_params [`impl_trait_param`]: https://rust-lang.github.io/rust-clippy/master/index.html#impl_trait_param [`implicit_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone [`implicit_hasher`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index 41b04f13721..9be4f5bf7fc 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -179,7 +179,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR_INFO, crate::from_str_radix_10::FROM_STR_RADIX_10_INFO, crate::functions::DOUBLE_MUST_USE_INFO, - crate::functions::IMPL_TRAIT_PARAM_INFO, + crate::functions::IMPL_TRAIT_IN_PARAMS_INFO, crate::functions::MISNAMED_GETTERS_INFO, crate::functions::MUST_USE_CANDIDATE_INFO, crate::functions::MUST_USE_UNIT_INFO, diff --git a/clippy_lints/src/functions/impl_trait_param.rs b/clippy_lints/src/functions/impl_trait_in_params.rs similarity index 98% rename from clippy_lints/src/functions/impl_trait_param.rs rename to clippy_lints/src/functions/impl_trait_in_params.rs index 1e819dc6c82..f0bfbbf1ea3 100644 --- a/clippy_lints/src/functions/impl_trait_param.rs +++ b/clippy_lints/src/functions/impl_trait_in_params.rs @@ -4,7 +4,7 @@ use rustc_hir::{intravisit::FnKind, Body, Generics, HirId}; use rustc_lint::LateContext; use rustc_span::Span; -use super::IMPL_TRAIT_PARAM; +use super::IMPL_TRAIT_IN_PARAMS; pub(super) fn check_fn<'tcx>(cx: &LateContext<'_>, kind: &'tcx FnKind<'_>, body: &'tcx Body<'_>, hir_id: HirId) { if cx.tcx.visibility(cx.tcx.hir().body_owner_def_id(body.id())).is_public() && !is_in_test_function(cx.tcx, hir_id) @@ -18,7 +18,7 @@ pub(super) fn check_fn<'tcx>(cx: &LateContext<'_>, kind: &'tcx FnKind<'_>, body: // No generics with nested generics, and no generics like FnMut(x) span_lint_and_then( cx, - IMPL_TRAIT_PARAM, + IMPL_TRAIT_IN_PARAMS, param.span, &format!("'{}' in the function's parameters", param.name.ident().as_str()), |diag| { diff --git a/clippy_lints/src/functions/mod.rs b/clippy_lints/src/functions/mod.rs index cd0df1438df..81b7bfe7181 100644 --- a/clippy_lints/src/functions/mod.rs +++ b/clippy_lints/src/functions/mod.rs @@ -1,4 +1,4 @@ -mod impl_trait_param; +mod impl_trait_in_params; mod misnamed_getters; mod must_use; mod not_unsafe_ptr_arg_deref; @@ -349,7 +349,7 @@ declare_clippy_lint! { /// } /// ``` #[clippy::version = "1.68.0"] - pub IMPL_TRAIT_PARAM, + pub IMPL_TRAIT_IN_PARAMS, style, "`impl Trait` is used in the function's parameters" } @@ -381,7 +381,7 @@ impl_lint_pass!(Functions => [ RESULT_UNIT_ERR, RESULT_LARGE_ERR, MISNAMED_GETTERS, - IMPL_TRAIT_PARAM, + IMPL_TRAIT_IN_PARAMS, ]); impl<'tcx> LateLintPass<'tcx> for Functions { @@ -399,7 +399,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions { too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold); not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id); misnamed_getters::check_fn(cx, kind, decl, body, span); - impl_trait_param::check_fn(cx, &kind, body, hir_id); + impl_trait_in_params::check_fn(cx, &kind, body, hir_id); } fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { diff --git a/clippy_utils/src/ast_utils.rs b/clippy_utils/src/ast_utils.rs index 62089320ce3..65d287d493b 100644 --- a/clippy_utils/src/ast_utils.rs +++ b/clippy_utils/src/ast_utils.rs @@ -6,7 +6,7 @@ clippy::similar_names, clippy::wildcard_imports, clippy::enum_glob_use, - clippy::impl_trait_param + clippy::impl_trait_in_params )] use crate::{both, over}; diff --git a/clippy_utils/src/check_proc_macro.rs b/clippy_utils/src/check_proc_macro.rs index 8650f3c6828..353926074b5 100644 --- a/clippy_utils/src/check_proc_macro.rs +++ b/clippy_utils/src/check_proc_macro.rs @@ -1,4 +1,4 @@ -#![allow(clippy::impl_trait_param)] +#![allow(clippy::impl_trait_in_params)] //! This module handles checking if the span given is from a proc-macro or not. //! //! Proc-macros are capable of setting the span of every token they output to a few possible spans. diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index 2cd213ed705..115d8aafaf7 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -1,4 +1,4 @@ -#![allow(clippy::impl_trait_param)] +#![allow(clippy::impl_trait_in_params)] use crate::consts::constant_simple; use crate::macros::macro_backtrace; use crate::source::snippet_opt; diff --git a/clippy_utils/src/macros.rs b/clippy_utils/src/macros.rs index a85d11f6234..cac29ac9c01 100644 --- a/clippy_utils/src/macros.rs +++ b/clippy_utils/src/macros.rs @@ -1,4 +1,4 @@ -#![allow(clippy::similar_names, clippy::impl_trait_param)] // `expr` and `expn` +#![allow(clippy::similar_names, clippy::impl_trait_in_params)] // `expr` and `expn` use crate::source::snippet_opt; use crate::visitors::{for_each_expr, Descend}; diff --git a/clippy_utils/src/source.rs b/clippy_utils/src/source.rs index 39d00e89551..e802941b5d8 100644 --- a/clippy_utils/src/source.rs +++ b/clippy_utils/src/source.rs @@ -1,6 +1,6 @@ //! Utils for extracting, inspecting or transforming source code -#![allow(clippy::module_name_repetitions, clippy::impl_trait_param)] +#![allow(clippy::module_name_repetitions, clippy::impl_trait_in_params)] use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind}; diff --git a/tests/ui/borrow_box.rs b/tests/ui/borrow_box.rs index e3e5b8464b7..3dfd8191adf 100644 --- a/tests/ui/borrow_box.rs +++ b/tests/ui/borrow_box.rs @@ -1,6 +1,6 @@ #![deny(clippy::borrowed_box)] #![allow(dead_code, unused_variables)] -#![allow(clippy::uninlined_format_args, clippy::disallowed_names, clippy::impl_trait_param)] +#![allow(clippy::uninlined_format_args, clippy::disallowed_names, clippy::impl_trait_in_params)] use std::fmt::Display; diff --git a/tests/ui/eta.fixed b/tests/ui/eta.fixed index 8c19143cb2e..c1ad0b66e01 100644 --- a/tests/ui/eta.fixed +++ b/tests/ui/eta.fixed @@ -8,7 +8,7 @@ clippy::option_map_unit_fn, clippy::redundant_closure_call, clippy::uninlined_format_args, - clippy::impl_trait_param + clippy::impl_trait_in_params )] use std::path::{Path, PathBuf}; diff --git a/tests/ui/eta.rs b/tests/ui/eta.rs index 10d4924c599..000af653c15 100644 --- a/tests/ui/eta.rs +++ b/tests/ui/eta.rs @@ -8,7 +8,7 @@ clippy::option_map_unit_fn, clippy::redundant_closure_call, clippy::uninlined_format_args, - clippy::impl_trait_param + clippy::impl_trait_in_params )] use std::path::{Path, PathBuf}; diff --git a/tests/ui/impl_trait_param.rs b/tests/ui/impl_trait_in_params.rs similarity index 85% rename from tests/ui/impl_trait_param.rs rename to tests/ui/impl_trait_in_params.rs index 3bb9cdbaa09..8402730d310 100644 --- a/tests/ui/impl_trait_param.rs +++ b/tests/ui/impl_trait_in_params.rs @@ -1,5 +1,5 @@ #![allow(unused)] -#![warn(clippy::impl_trait_param)] +#![warn(clippy::impl_trait_in_params)] pub trait Trait {} diff --git a/tests/ui/impl_trait_param.stderr b/tests/ui/impl_trait_in_params.stderr similarity index 100% rename from tests/ui/impl_trait_param.stderr rename to tests/ui/impl_trait_in_params.stderr diff --git a/tests/ui/trait_duplication_in_bounds.fixed b/tests/ui/trait_duplication_in_bounds.fixed index a587cc8b456..373859a2564 100644 --- a/tests/ui/trait_duplication_in_bounds.fixed +++ b/tests/ui/trait_duplication_in_bounds.fixed @@ -1,6 +1,6 @@ // run-rustfix #![deny(clippy::trait_duplication_in_bounds)] -#![allow(clippy::impl_trait_param)] +#![allow(clippy::impl_trait_in_params)] #![allow(unused)] fn bad_foo(arg0: T, argo1: U) { diff --git a/tests/ui/trait_duplication_in_bounds.rs b/tests/ui/trait_duplication_in_bounds.rs index beb41ea26d9..3afd74aa9b2 100644 --- a/tests/ui/trait_duplication_in_bounds.rs +++ b/tests/ui/trait_duplication_in_bounds.rs @@ -1,6 +1,6 @@ // run-rustfix #![deny(clippy::trait_duplication_in_bounds)] -#![allow(clippy::impl_trait_param)] +#![allow(clippy::impl_trait_in_params)] #![allow(unused)] fn bad_foo(arg0: T, argo1: U) { diff --git a/tests/ui/trait_duplication_in_bounds_unfixable.rs b/tests/ui/trait_duplication_in_bounds_unfixable.rs index 63ae4493143..7435a4ba609 100644 --- a/tests/ui/trait_duplication_in_bounds_unfixable.rs +++ b/tests/ui/trait_duplication_in_bounds_unfixable.rs @@ -1,5 +1,5 @@ #![deny(clippy::trait_duplication_in_bounds)] -#![allow(clippy::impl_trait_param)] +#![allow(clippy::impl_trait_in_params)] use std::collections::BTreeMap; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};