about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-03-17 16:30:27 +0100
committerSamuel Tardieu <sam@rfc1149.net>2025-06-18 06:41:40 +0200
commitd66e4f6a662346c17fd9461126704f096c2b6a3d (patch)
treec16032ff234ee22f40d5a04c377594e6316a4022 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent19c1c709054ea1964d942259c5c33ad6489cd1e0 (diff)
downloadrust-d66e4f6a662346c17fd9461126704f096c2b6a3d.tar.gz
rust-d66e4f6a662346c17fd9461126704f096c2b6a3d.zip
Restrict the cases where Clippy proposes to switch range types
To limit 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. Also,
when the range is used as a function or method call argument and the
parameter type is generic over traits implemented by both kind of
ranges, the lint will trigger.

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.

This fix doesn't prevent false positives from happening. A more complete
fix would check if the obligations can be satisfied by the new proposed
range type.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions