File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,21 @@ declare_clippy_lint! {
397397 /// ### Why is this bad?
398398 /// One might think that modifying the mutable variable changes the loop bounds
399399 ///
400+ /// ### Known problems
401+ /// False positive when mutation is followed by a `break`, but the `break` is not immediately
402+ /// after the mutation:
403+ ///
404+ /// ```rust
405+ /// let mut x = 5;
406+ /// for _ in 0..x {
407+ /// x += 1; // x is a range bound that is mutated
408+ /// ..; // some other expression
409+ /// break; // leaves the loop, so mutation is not an issue
410+ /// }
411+ /// ```
412+ ///
413+ /// False positive on nested loops ([#6072](https://github.com/rust-lang/rust-clippy/issues/6072))
414+ ///
400415 /// ### Example
401416 /// ```rust
402417 /// let mut foo = 42;
You can’t perform that action at this time.
0 commit comments