Skip to content

Commit

Permalink
Auto merge of #10168 - blyxyas:fix_reversed_empty_ranges, r=dswij
Browse files Browse the repository at this point in the history
[#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

---

Fixes #10167
changelog: [`reversed_empty_ranges`]: Update and clarify documentation
  • Loading branch information
bors committed Jan 6, 2023
2 parents 3f0d0c1 + 1b9a25e commit 19b79c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ declare_clippy_lint! {
declare_clippy_lint! {
/// ### What it does
/// 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?
/// Empty ranges yield no values so iterating them is a no-op.
Expand Down

0 comments on commit 19b79c4

Please sign in to comment.