Skip to content

Commit

Permalink
Rollup merge of rust-lang#89895 - camsteffen:for-loop-head-span, r=da…
Browse files Browse the repository at this point in the history
…vidtwco

Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at rust-lang/rust-clippy#7789 (comment).
  • Loading branch information
JohnTitor authored Oct 22, 2021
2 parents 7631fc5 + 449d68d commit efef16f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions clippy_lints/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessVec {
if is_copy(cx, vec_type(cx.typeck_results().expr_ty_adjusted(arg)));
then {
// report the error around the `vec!` not inside `<std macros>:`
let span = arg.span
.ctxt()
.outer_expn_data()
.call_site
.ctxt()
.outer_expn_data()
.call_site;
let span = arg.span.ctxt().outer_expn_data().call_site;
self.check_vec_macro(cx, &vec_args, Mutability::Not, span);
}
}
Expand Down

0 comments on commit efef16f

Please sign in to comment.