We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
mut_range_bound
1 parent 7515d9c commit 7c40cfdCopy full SHA for 7c40cfd
clippy_lints/src/loops/mod.rs
@@ -397,6 +397,18 @@ declare_clippy_lint! {
397
/// ### Why is this bad?
398
/// One might think that modifying the mutable variable changes the loop bounds
399
///
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
+ /// ```
405
+ /// x += 1; // x is a range bound that is mutated
406
+ /// some_other_expr();
407
+ /// break; // leaves the loop, so mutation is not an issue
408
409
410
+ /// False positive on nested loops ([#6072](https://github.com/rust-lang/rust-clippy/issues/6072))
411
412
/// ### Example
413
/// ```rust
414
/// let mut foo = 42;
0 commit comments