Fix a warning when generating tests
auto merge of #7591 : alexcrichton/rust/fix-warnings, r=huonw

Closes #7589