Skip to content

Commit

Permalink
Add known problems to mut_range_bound docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dswij committed Sep 8, 2021
1 parent 7515d9c commit 7c40cfd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clippy_lints/src/loops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,18 @@ declare_clippy_lint! {
/// ### 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:
///
/// ```
/// x += 1; // x is a range bound that is mutated
/// some_other_expr();
/// 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
/// ```rust
/// let mut foo = 42;
Expand Down

0 comments on commit 7c40cfd

Please sign in to comment.