Don't mark for loop head span with desugaring

This commit is contained in:
Cameron Steffen 2021-10-14 16:19:39 -05:00
parent 313e71a253
commit bd1a1e4f0d
5 changed files with 48 additions and 53 deletions

View file

@ -134,9 +134,8 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
Applicability::MachineApplicable,
);
if self.for_expr_span == expr.span {
let expr_span = expr.span.ctxt().outer_expn_data().call_site;
diag.span_suggestion(
receiver_arg.span.shrink_to_hi().to(expr_span.shrink_to_hi()),
receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()),
"or remove `.into_iter()` to iterate by value",
String::new(),
Applicability::MaybeIncorrect,