From bcbb07f4dc3c147b9f4259df7f8c6a8b2bf91729 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Thu, 17 Feb 2022 11:20:47 +0000 Subject: [PATCH] Rename RecursiveFormatImpl to FormatImpl --- .../src/{recursive_format_impl.rs => format_impl.rs} | 9 ++++----- clippy_lints/src/lib.register_all.rs | 2 +- clippy_lints/src/lib.register_correctness.rs | 2 +- clippy_lints/src/lib.register_lints.rs | 2 +- clippy_lints/src/lib.rs | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) rename clippy_lints/src/{recursive_format_impl.rs => format_impl.rs} (97%) diff --git a/clippy_lints/src/recursive_format_impl.rs b/clippy_lints/src/format_impl.rs similarity index 97% rename from clippy_lints/src/recursive_format_impl.rs rename to clippy_lints/src/format_impl.rs index 5bb9740749b6..02b2d7219399 100644 --- a/clippy_lints/src/recursive_format_impl.rs +++ b/clippy_lints/src/format_impl.rs @@ -21,7 +21,6 @@ impl FormatTrait { } } } - declare_clippy_lint! { /// ### What it does /// Checks for format trait implementations (e.g. `Display`) with a recursive call to itself @@ -62,12 +61,12 @@ declare_clippy_lint! { } #[derive(Default)] -pub struct RecursiveFormatImpl { +pub struct FormatImpl { // Whether we are inside Display or Debug trait impl - None for neither format_trait_impl: Option, } -impl RecursiveFormatImpl { +impl FormatImpl { pub fn new() -> Self { Self { format_trait_impl: None, @@ -75,9 +74,9 @@ impl RecursiveFormatImpl { } } -impl_lint_pass!(RecursiveFormatImpl => [RECURSIVE_FORMAT_IMPL]); +impl_lint_pass!(FormatImpl => [RECURSIVE_FORMAT_IMPL]); -impl<'tcx> LateLintPass<'tcx> for RecursiveFormatImpl { +impl<'tcx> LateLintPass<'tcx> for FormatImpl { fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { if let Some(format_trait_impl) = is_format_trait_impl(cx, item) { self.format_trait_impl = Some(format_trait_impl); diff --git a/clippy_lints/src/lib.register_all.rs b/clippy_lints/src/lib.register_all.rs index c6f8470cd7db..b2d9889ba865 100644 --- a/clippy_lints/src/lib.register_all.rs +++ b/clippy_lints/src/lib.register_all.rs @@ -68,6 +68,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![ LintId::of(format::USELESS_FORMAT), LintId::of(format_args::FORMAT_IN_FORMAT_ARGS), LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS), + LintId::of(format_impl::RECURSIVE_FORMAT_IMPL), LintId::of(formatting::POSSIBLE_MISSING_COMMA), LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING), LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING), @@ -244,7 +245,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![ LintId::of(ranges::MANUAL_RANGE_CONTAINS), LintId::of(ranges::RANGE_ZIP_WITH_LEN), LintId::of(ranges::REVERSED_EMPTY_RANGES), - LintId::of(recursive_format_impl::RECURSIVE_FORMAT_IMPL), LintId::of(redundant_clone::REDUNDANT_CLONE), LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL), LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES), diff --git a/clippy_lints/src/lib.register_correctness.rs b/clippy_lints/src/lib.register_correctness.rs index 18fe44282ed0..35b1e644a8a7 100644 --- a/clippy_lints/src/lib.register_correctness.rs +++ b/clippy_lints/src/lib.register_correctness.rs @@ -24,6 +24,7 @@ store.register_group(true, "clippy::correctness", Some("clippy_correctness"), ve LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT), LintId::of(eq_op::EQ_OP), LintId::of(erasing_op::ERASING_OP), + LintId::of(format_impl::RECURSIVE_FORMAT_IMPL), LintId::of(formatting::POSSIBLE_MISSING_COMMA), LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF), LintId::of(if_let_mutex::IF_LET_MUTEX), @@ -52,7 +53,6 @@ store.register_group(true, "clippy::correctness", Some("clippy_correctness"), ve LintId::of(ptr::INVALID_NULL_PTR_USAGE), LintId::of(ptr::MUT_FROM_REF), LintId::of(ranges::REVERSED_EMPTY_RANGES), - LintId::of(recursive_format_impl::RECURSIVE_FORMAT_IMPL), LintId::of(regex::INVALID_REGEX), LintId::of(self_assignment::SELF_ASSIGNMENT), LintId::of(serde_api::SERDE_API_MISUSE), diff --git a/clippy_lints/src/lib.register_lints.rs b/clippy_lints/src/lib.register_lints.rs index 75ef1b0a9d51..1243fc978b7c 100644 --- a/clippy_lints/src/lib.register_lints.rs +++ b/clippy_lints/src/lib.register_lints.rs @@ -152,6 +152,7 @@ store.register_lints(&[ format::USELESS_FORMAT, format_args::FORMAT_IN_FORMAT_ARGS, format_args::TO_STRING_IN_FORMAT_ARGS, + format_impl::RECURSIVE_FORMAT_IMPL, formatting::POSSIBLE_MISSING_COMMA, formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING, formatting::SUSPICIOUS_ELSE_FORMATTING, @@ -417,7 +418,6 @@ store.register_lints(&[ ranges::RANGE_PLUS_ONE, ranges::RANGE_ZIP_WITH_LEN, ranges::REVERSED_EMPTY_RANGES, - recursive_format_impl::RECURSIVE_FORMAT_IMPL, redundant_clone::REDUNDANT_CLONE, redundant_closure_call::REDUNDANT_CLOSURE_CALL, redundant_else::REDUNDANT_ELSE, diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index a21a87899aa1..230e2b2ccdfb 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -226,6 +226,7 @@ mod float_literal; mod floating_point_arithmetic; mod format; mod format_args; +mod format_impl; mod formatting; mod from_over_into; mod from_str_radix_10; @@ -333,7 +334,6 @@ mod ptr_eq; mod ptr_offset_with_cast; mod question_mark; mod ranges; -mod recursive_format_impl; mod redundant_clone; mod redundant_closure_call; mod redundant_else; @@ -705,7 +705,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|| Box::new(modulo_arithmetic::ModuloArithmetic)); store.register_early_pass(|| Box::new(reference::DerefAddrOf)); store.register_early_pass(|| Box::new(double_parens::DoubleParens)); - store.register_late_pass(|| Box::new(recursive_format_impl::RecursiveFormatImpl::new())); + store.register_late_pass(|| Box::new(format_impl::FormatImpl::new())); store.register_early_pass(|| Box::new(unsafe_removed_from_name::UnsafeNameRemoval)); store.register_early_pass(|| Box::new(else_if_without_else::ElseIfWithoutElse)); store.register_early_pass(|| Box::new(int_plus_one::IntPlusOne));