diff options
Diffstat (limited to 'src/docs/mut_range_bound.txt')
| -rw-r--r-- | src/docs/mut_range_bound.txt | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/docs/mut_range_bound.txt b/src/docs/mut_range_bound.txt deleted file mode 100644 index e9c38a543b1..00000000000 --- a/src/docs/mut_range_bound.txt +++ /dev/null @@ -1,29 +0,0 @@ -### What it does -Checks for loops which have a range bound that is a mutable variable - -### Why is this bad? -One might think that modifying the mutable variable changes the loop bounds - -### Known problems -False positive when mutation is followed by a `break`, but the `break` is not immediately -after the mutation: - -``` -let mut x = 5; -for _ in 0..x { - x += 1; // x is a range bound that is mutated - ..; // some other expression - break; // leaves the loop, so mutation is not an issue -} -``` - -False positive on nested loops ([#6072](https://github.com/rust-lang/rust-clippy/issues/6072)) - -### Example -``` -let mut foo = 42; -for i in 0..foo { - foo -= 1; - println!("{}", i); // prints numbers from 0 to 42, not 0 to 21 -} -``` \ No newline at end of file |
