Add a lint pass to check for while true { ... } loops
And suggest changing them to loop { ... }. Had to fix the few
remaining while true loops (in core::io). Closes #1962.
This commit is contained in:
parent
594d22e7e2
commit
cdc8722f95
3 changed files with 47 additions and 5 deletions
8
src/test/compile-fail/issue-1962.rs
Normal file
8
src/test/compile-fail/issue-1962.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -W err-while-true
|
||||
fn main() {
|
||||
let mut i = 0;
|
||||
while true { //! ERROR Denote infinite loops with loop
|
||||
i += 1;
|
||||
if i == 5 { break; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue