Skip to content

Commit

Permalink
Remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
francorbacho committed Oct 4, 2023
1 parent 13c249f commit 6ec9fb5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ fn report_redundant_format_arguments(
let mut fmt_arg_indices = vec![];
let mut args_spans = vec![];
let mut fmt_spans = vec![];
let mut bindings = vec![];

for (i, unnamed_arg) in args.unnamed_args().iter().enumerate().rev() {
let Some(ty) = unnamed_arg.expr.to_ty() else { continue };
Expand All @@ -725,17 +724,17 @@ fn report_redundant_format_arguments(
let matching_placeholders = placeholders
.iter()
.filter(|(_, inline_binding)| argument_binding == *inline_binding)
.map(|(span, _)| span)
.collect::<Vec<_>>();

if !matching_placeholders.is_empty() {
fmt_arg_indices.push(i);
args_spans.push(unnamed_arg.expr.span);
for (span, binding) in &matching_placeholders {
if fmt_spans.contains(span) {
for span in &matching_placeholders {
if fmt_spans.contains(*span) {
continue;
}
fmt_spans.push(*span);
bindings.push(binding);
fmt_spans.push(**span);
}
}
}
Expand Down

0 comments on commit 6ec9fb5

Please sign in to comment.