Fix issue #17999 (Unused variables inside `for` are not detected)
auto merge of #18014 : hirschenberger/rust/issue-17999, r=alexcrichton

Fix issue #17999 (Unused variables inside `for` are not detected)