gnu/gcc/548fbf6f2c9c2acb1e6fdde93d217ee042eafd23 gccrs: add non_contiguous_range_endpoints lint
Warn when an exclusive range pattern and the next arm are one value
apart, such as `20..30` followed by `31..=40`, which silently skips 30.
gcc/rust/ChangeLog:
* checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit):
New.
* checks/lints/unused/rust-unused-checker.h (UnusedChecker::visit):
New.
gcc/testsuite/ChangeLog:
* rust/compile/non-contiguous-range-endpoints_0.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
3 files changed