1
Fork 0

for_loop_over_fallibles: fix suggestion for "remove .next()" case

if the iterator is used after the loop, we need to use `.by_ref()`
This commit is contained in:
Maybe Waffle 2022-07-25 00:58:04 +04:00
parent 7308564423
commit 23a7674e3e
2 changed files with 3 additions and 4 deletions

View file

@ -82,7 +82,7 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopOverFallibles {
warn.span_suggestion(
recv.span.between(arg.span.shrink_to_hi()),
format!("to iterate over `{recv_snip}` remove the call to `next`"),
"",
".by_ref()",
Applicability::MaybeIncorrect
);
} else {