about summary refs log tree commit diff
diff options
context:
space:
mode:
authordswij <dharmasw@outlook.com>2025-07-12 06:20:15 +0000
committerGitHub <noreply@github.com>2025-07-12 06:20:15 +0000
commit3d7188d06df87b230b8464871f701397330535fb (patch)
treef4f57ae7628547e792c1cf17a75098dbff9deab8
parente2270bb9e582465099fbad550be13f6892339f42 (diff)
parent6b6f35ec651853dd8ec4d8d2a43b0872c47636ec (diff)
downloadrust-3d7188d06df87b230b8464871f701397330535fb.tar.gz
rust-3d7188d06df87b230b8464871f701397330535fb.zip
Add `uninlined_format_args` example for `{:?}` (#15228)
Before this, you had to guess how to fix a `{:?}` formatting argument. I
have happened to guess `{:?var}` in the past, got frustrated, and
disabled the lint. This additional example would have saved me a bit of
trouble.

changelog: [`uninlined_format_args`]: added an example of how to fix a
`{:?}` parameter.
-rw-r--r--clippy_lints/src/format_args.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_lints/src/format_args.rs b/clippy_lints/src/format_args.rs
index 0c39aae9ca9..138fab9c639 100644
--- a/clippy_lints/src/format_args.rs
+++ b/clippy_lints/src/format_args.rs
@@ -128,6 +128,7 @@ declare_clippy_lint! {
     /// # let width = 1;
     /// # let prec = 2;
     /// format!("{}", var);
+    /// format!("{:?}", var);
     /// format!("{v:?}", v = var);
     /// format!("{0} {0}", var);
     /// format!("{0:1$}", var, width);
@@ -140,6 +141,7 @@ declare_clippy_lint! {
     /// # let prec = 2;
     /// format!("{var}");
     /// format!("{var:?}");
+    /// format!("{var:?}");
     /// format!("{var} {var}");
     /// format!("{var:width$}");
     /// format!("{var:.prec$}");