fix overlapping spans for clippy::uninlined_format_args

This commit is contained in:
Lukas Markeffsky 2023-01-19 21:45:38 +01:00
parent 11611b0440
commit 10c868686d

View file

@ -311,6 +311,10 @@ fn check_uninlined_args(
// in those cases, make the code suggestion hidden
let multiline_fix = fixes.iter().any(|(span, _)| cx.sess().source_map().is_multiline(*span));
// Suggest removing each argument only once, for example in `format!("{0} {0}", arg)`.
fixes.sort_unstable_by_key(|(span, _)| *span);
fixes.dedup_by_key(|(span, _)| *span);
span_lint_and_then(
cx,
UNINLINED_FORMAT_ARGS,