blob: 71800701f489717154a3f9dedf896b1a34cad092 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
### What it does
Checks whether variables used within while loop condition
can be (and are) mutated in the body.
### Why is this bad?
If the condition is unchanged, entering the body of the loop
will lead to an infinite loop.
### Known problems
If the `while`-loop is in a closure, the check for mutation of the
condition variables in the body can cause false negatives. For example when only `Upvar` `a` is
in the condition and only `Upvar` `b` gets mutated in the body, the lint will not trigger.
### Example
```
let i = 0;
while i > 10 {
println!("let me loop forever!");
}
```
|