We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
clippy::uninlined_format_args
1 parent e415e2f commit 228ddf0Copy full SHA for 228ddf0
src/tools/clippy/clippy_lints/src/format_args.rs
@@ -311,6 +311,10 @@ fn check_uninlined_args(
311
// in those cases, make the code suggestion hidden
312
let multiline_fix = fixes.iter().any(|(span, _)| cx.sess().source_map().is_multiline(*span));
313
314
+ // Suggest removing each argument only once, for example in `format!("{0} {0}", arg)`.
315
+ fixes.sort_unstable_by_key(|(span, _)| *span);
316
+ fixes.dedup_by_key(|(span, _)| *span);
317
+
318
span_lint_and_then(
319
cx,
320
UNINLINED_FORMAT_ARGS,
0 commit comments