err: &mut DiagnosticBuilder<'a>,
binds_to: &[Local],
) {
- let mut suggestions: Vec<(Span, String, String)> = Vec::new();
+ let mut suggestions: Vec<(Span, &str, String)> = Vec::new();
for local in binds_to {
let bind_to = &self.mir.local_decls[*local];
if let Some(
}
suggestions.push((
pat_span,
- format!("consider removing the `{}`", to_remove),
+ to_remove,
suggestion.to_owned(),
));
}
}
suggestions.sort_unstable_by_key(|&(span, _, _)| span);
suggestions.dedup_by_key(|&mut (span, _, _)| span);
- for (span, msg, suggestion) in suggestions {
- err.span_suggestion(span, &msg, suggestion);
+ for (span, to_remove, suggestion) in suggestions {
+ err.span_suggestion(
+ span,
+ &format!("consider removing the `{}`", to_remove),
+ suggestion
+ );
}
}