[#10167] Clarify that the lint only works if x eq. y in a for loop.

Reading the documentation for the lint, one could expect that the lint works in all cases that `X == Y`. This is false.

While the lint was updated, the documentation wasn't.

More information about the `N..N` problem in #5689 and #5628
This commit is contained in:
blyxyas 2023-01-06 14:41:50 +01:00
parent 179a22f624
commit 1b9a25e28d
No known key found for this signature in database
GPG key ID: 4D38170B5A2FC334

View file

@ -103,7 +103,7 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for range expressions `x..y` where both `x` and `y` /// Checks for range expressions `x..y` where both `x` and `y`
/// are constant and `x` is greater or equal to `y`. /// are constant and `x` is greater to `y`. Also triggers if `x` is equal to `y` when they are conditions to a `for` loop.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Empty ranges yield no values so iterating them is a no-op. /// Empty ranges yield no values so iterating them is a no-op.