about summary refs log tree commit diff
path: root/clippy_lints/src/lib.rs
diff options
context:
space:
mode:
authorJames McMurray <jamesmcm03@gmail.com>2021-12-28 19:27:11 +0100
committerJames McMurray <jamesmcm03@gmail.com>2022-02-14 18:49:51 +0100
commitb162b11abc4c5275b2bf2f2f4679f0b6d72be2cb (patch)
tree764a0bb732ad879f301360a9680bbe3ab8068126 /clippy_lints/src/lib.rs
parent4931cab709401cc8350598eab9bd51031c89565a (diff)
Add recursive_format_impl lint
The to_string_in_display lint is renamed to recursive_format_impl
A check is added for the use of self formatted with Display or Debug
inside any format string in the same impl
The to_string_in_display check is kept as is - like in the
format_in_format_args lint

For now only Display and Debug are checked
This could also be extended to other Format traits (Binary, etc.)
Diffstat (limited to 'clippy_lints/src/lib.rs')
-rw-r--r--clippy_lints/src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index e78f6187359..93b1d178ac2 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -332,6 +332,7 @@ 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;
@@ -364,7 +365,6 @@ mod swap;
 mod tabs_in_doc_comments;
 mod temporary_assignment;
 mod to_digit_is_some;
-mod to_string_in_display;
 mod trailing_empty_array;
 mod trait_bounds;
 mod transmute;
@@ -704,7 +704,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(to_string_in_display::ToStringInDisplay::new()));
+    store.register_late_pass(|| Box::new(recursive_format_impl::RecursiveFormatImpl::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));
@@ -938,6 +938,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
     ls.register_renamed("clippy::disallowed_type", "clippy::disallowed_types");
     ls.register_renamed("clippy::disallowed_method", "clippy::disallowed_methods");
     ls.register_renamed("clippy::ref_in_deref", "clippy::needless_borrow");
+    ls.register_renamed("clippy::to_string_in_display", "clippy::recursive_format_impl");
 
     // uplifted lints
     ls.register_renamed("clippy::invalid_ref", "invalid_value");