Skip to content

Commit efef16f

Browse files
authored
Rollup merge of rust-lang#89895 - camsteffen:for-loop-head-span, r=davidtwco
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).
2 parents 7631fc5 + 449d68d commit efef16f

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

clippy_lints/src/vec.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessVec {
6363
if is_copy(cx, vec_type(cx.typeck_results().expr_ty_adjusted(arg)));
6464
then {
6565
// report the error around the `vec!` not inside `<std macros>:`
66-
let span = arg.span
67-
.ctxt()
68-
.outer_expn_data()
69-
.call_site
70-
.ctxt()
71-
.outer_expn_data()
72-
.call_site;
66+
let span = arg.span.ctxt().outer_expn_data().call_site;
7367
self.check_vec_macro(cx, &vec_args, Mutability::Not, span);
7468
}
7569
}

0 commit comments

Comments
 (0)