about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-slice-array.js
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2025-07-16 16:21:45 +0000
committerGitHub <noreply@github.com>2025-07-16 16:21:45 +0000
commite113e66606834f0b8eb992c02798f1c737c6cac8 (patch)
tree60f8c98ee630b3a46c6e612c104480e5aaea190e /tests/rustdoc-js-std/parser-slice-array.js
parent2a4c83dcc19d05a6ac2cd5cdc2c3e30d60163619 (diff)
parent15fc993775703c2151d4aa62bb484840aa560202 (diff)
downloadrust-e113e66606834f0b8eb992c02798f1c737c6cac8.tar.gz
rust-e113e66606834f0b8eb992c02798f1c737c6cac8.zip
Propose to exchange ranges only when it is safe to do so (#14432)
To avoid false positives, the `range_plus_one` and `range_minus_one`
lints will restrict themselves to situations where the iterator types
can be easily switched from exclusive to inclusive or vice-versa. This
includes situations where the range is used as an iterator, or is used
for indexing.

On the other hand, assignments of the range to variables, including
automatically typed ones or wildcards, will no longer trigger the lint.
However, the cases where such an assignment would benefit from the lint
are probably rare.

In a second commit, the `range_plus_one` and `range_minus_one` logic are
unified, in order to properly emit parentheses around the suggestion
when needed.

Fix rust-lang/rust-clippy#3307
Fix rust-lang/rust-clippy#9908

changelog: [`range_plus_one`, `range_minus_one`]: restrict lint to cases
where it is safe to switch the range type

*Edit:* as a consequence, this led to the removal of three
`#[expect(clippy::range_plus_one)]` in the Clippy sources to avoid those
false positives.
Diffstat (limited to 'tests/rustdoc-js-std/parser-slice-array.js')
0 files changed, 0 insertions, 0 deletions