Skip to content

Commit 228ddf0

Browse files
author
Lukas Markeffsky
committed
fix overlapping spans for clippy::uninlined_format_args
1 parent e415e2f commit 228ddf0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tools/clippy/clippy_lints/src/format_args.rs

+4
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ fn check_uninlined_args(
311311
// in those cases, make the code suggestion hidden
312312
let multiline_fix = fixes.iter().any(|(span, _)| cx.sess().source_map().is_multiline(*span));
313313

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+
314318
span_lint_and_then(
315319
cx,
316320
UNINLINED_FORMAT_ARGS,

0 commit comments

Comments
 (0)