Update clippy tests for stable exclusive_range

This commit is contained in:
Ross Smyth 2024-04-28 00:39:32 -04:00
parent 80c6f8ff7b
commit 68a6cbfc6c
10 changed files with 66 additions and 72 deletions

View file

@ -1,7 +1,6 @@
//@edition:2018
//@aux-build:proc_macros.rs
#![feature(exclusive_range_pattern)]
#![feature(stmt_expr_attributes)]
#![warn(clippy::almost_complete_range)]
#![allow(ellipsis_inclusive_range_patterns)]

View file

@ -1,7 +1,6 @@
//@edition:2018
//@aux-build:proc_macros.rs
#![feature(exclusive_range_pattern)]
#![feature(stmt_expr_attributes)]
#![warn(clippy::almost_complete_range)]
#![allow(ellipsis_inclusive_range_patterns)]

View file

@ -1,5 +1,5 @@
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:18:17
--> tests/ui/almost_complete_range.rs:17:17
|
LL | let _ = ('a') ..'z';
| ^^^^^^--^^^
@ -10,7 +10,7 @@ LL | let _ = ('a') ..'z';
= help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:19:17
--> tests/ui/almost_complete_range.rs:18:17
|
LL | let _ = 'A' .. ('Z');
| ^^^^--^^^^^^
@ -18,7 +18,7 @@ LL | let _ = 'A' .. ('Z');
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:20:17
--> tests/ui/almost_complete_range.rs:19:17
|
LL | let _ = ((('0'))) .. ('9');
| ^^^^^^^^^^--^^^^^^
@ -26,7 +26,7 @@ LL | let _ = ((('0'))) .. ('9');
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:27:13
--> tests/ui/almost_complete_range.rs:26:13
|
LL | let _ = (b'a')..(b'z');
| ^^^^^^--^^^^^^
@ -34,7 +34,7 @@ LL | let _ = (b'a')..(b'z');
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:28:13
--> tests/ui/almost_complete_range.rs:27:13
|
LL | let _ = b'A'..b'Z';
| ^^^^--^^^^
@ -42,7 +42,7 @@ LL | let _ = b'A'..b'Z';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:29:13
--> tests/ui/almost_complete_range.rs:28:13
|
LL | let _ = b'0'..b'9';
| ^^^^--^^^^
@ -50,7 +50,7 @@ LL | let _ = b'0'..b'9';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:35:13
--> tests/ui/almost_complete_range.rs:34:13
|
LL | let _ = inline!('a')..'z';
| ^^^^^^^^^^^^--^^^
@ -58,7 +58,7 @@ LL | let _ = inline!('a')..'z';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:36:13
--> tests/ui/almost_complete_range.rs:35:13
|
LL | let _ = inline!('A')..'Z';
| ^^^^^^^^^^^^--^^^
@ -66,7 +66,7 @@ LL | let _ = inline!('A')..'Z';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:37:13
--> tests/ui/almost_complete_range.rs:36:13
|
LL | let _ = inline!('0')..'9';
| ^^^^^^^^^^^^--^^^
@ -74,7 +74,7 @@ LL | let _ = inline!('0')..'9';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:40:9
--> tests/ui/almost_complete_range.rs:39:9
|
LL | b'a'..b'z' if true => 1,
| ^^^^--^^^^
@ -82,7 +82,7 @@ LL | b'a'..b'z' if true => 1,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:41:9
--> tests/ui/almost_complete_range.rs:40:9
|
LL | b'A'..b'Z' if true => 2,
| ^^^^--^^^^
@ -90,7 +90,7 @@ LL | b'A'..b'Z' if true => 2,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:42:9
--> tests/ui/almost_complete_range.rs:41:9
|
LL | b'0'..b'9' if true => 3,
| ^^^^--^^^^
@ -98,7 +98,7 @@ LL | b'0'..b'9' if true => 3,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:50:9
--> tests/ui/almost_complete_range.rs:49:9
|
LL | 'a'..'z' if true => 1,
| ^^^--^^^
@ -106,7 +106,7 @@ LL | 'a'..'z' if true => 1,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:51:9
--> tests/ui/almost_complete_range.rs:50:9
|
LL | 'A'..'Z' if true => 2,
| ^^^--^^^
@ -114,7 +114,7 @@ LL | 'A'..'Z' if true => 2,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:52:9
--> tests/ui/almost_complete_range.rs:51:9
|
LL | '0'..'9' if true => 3,
| ^^^--^^^
@ -122,7 +122,7 @@ LL | '0'..'9' if true => 3,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:65:17
--> tests/ui/almost_complete_range.rs:64:17
|
LL | let _ = 'a'..'z';
| ^^^--^^^
@ -132,7 +132,7 @@ LL | let _ = 'a'..'z';
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:66:17
--> tests/ui/almost_complete_range.rs:65:17
|
LL | let _ = 'A'..'Z';
| ^^^--^^^
@ -142,7 +142,7 @@ LL | let _ = 'A'..'Z';
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:67:17
--> tests/ui/almost_complete_range.rs:66:17
|
LL | let _ = '0'..'9';
| ^^^--^^^
@ -152,7 +152,7 @@ LL | let _ = '0'..'9';
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:74:9
--> tests/ui/almost_complete_range.rs:73:9
|
LL | 'a'..'z' => 1,
| ^^^--^^^
@ -160,7 +160,7 @@ LL | 'a'..'z' => 1,
| help: use an inclusive range: `...`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:75:9
--> tests/ui/almost_complete_range.rs:74:9
|
LL | 'A'..'Z' => 2,
| ^^^--^^^
@ -168,7 +168,7 @@ LL | 'A'..'Z' => 2,
| help: use an inclusive range: `...`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:76:9
--> tests/ui/almost_complete_range.rs:75:9
|
LL | '0'..'9' => 3,
| ^^^--^^^
@ -176,7 +176,7 @@ LL | '0'..'9' => 3,
| help: use an inclusive range: `...`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:83:13
--> tests/ui/almost_complete_range.rs:82:13
|
LL | let _ = 'a'..'z';
| ^^^--^^^
@ -184,7 +184,7 @@ LL | let _ = 'a'..'z';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:84:13
--> tests/ui/almost_complete_range.rs:83:13
|
LL | let _ = 'A'..'Z';
| ^^^--^^^
@ -192,7 +192,7 @@ LL | let _ = 'A'..'Z';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:85:13
--> tests/ui/almost_complete_range.rs:84:13
|
LL | let _ = '0'..'9';
| ^^^--^^^
@ -200,7 +200,7 @@ LL | let _ = '0'..'9';
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:87:9
--> tests/ui/almost_complete_range.rs:86:9
|
LL | 'a'..'z' => 1,
| ^^^--^^^
@ -208,7 +208,7 @@ LL | 'a'..'z' => 1,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:88:9
--> tests/ui/almost_complete_range.rs:87:9
|
LL | 'A'..'Z' => 1,
| ^^^--^^^
@ -216,7 +216,7 @@ LL | 'A'..'Z' => 1,
| help: use an inclusive range: `..=`
error: almost complete ascii range
--> tests/ui/almost_complete_range.rs:89:9
--> tests/ui/almost_complete_range.rs:88:9
|
LL | '0'..'9' => 3,
| ^^^--^^^

View file

@ -1,7 +1,6 @@
#![allow(unused)]
#![allow(non_contiguous_range_endpoints)]
#![warn(clippy::manual_range_patterns)]
#![feature(exclusive_range_pattern)]
fn main() {
let f = 6;

View file

@ -1,7 +1,6 @@
#![allow(unused)]
#![allow(non_contiguous_range_endpoints)]
#![warn(clippy::manual_range_patterns)]
#![feature(exclusive_range_pattern)]
fn main() {
let f = 6;

View file

@ -1,5 +1,5 @@
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:9:25
--> tests/ui/manual_range_patterns.rs:8:25
|
LL | let _ = matches!(f, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10`
@ -8,109 +8,109 @@ LL | let _ = matches!(f, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10);
= help: to override `-D warnings` add `#[allow(clippy::manual_range_patterns)]`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:10:25
--> tests/ui/manual_range_patterns.rs:9:25
|
LL | let _ = matches!(f, 4 | 2 | 3 | 1 | 5 | 6 | 9 | 7 | 8 | 10);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:17:25
--> tests/ui/manual_range_patterns.rs:16:25
|
LL | let _ = matches!(f, 1 | (2..=4));
| ^^^^^^^^^^^ help: try: `1..=4`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:18:25
--> tests/ui/manual_range_patterns.rs:17:25
|
LL | let _ = matches!(f, 1 | (2..4));
| ^^^^^^^^^^ help: try: `1..4`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:19:25
--> tests/ui/manual_range_patterns.rs:18:25
|
LL | let _ = matches!(f, (1..=10) | (2..=13) | (14..=48324728) | 48324729);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=48324729`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:20:25
--> tests/ui/manual_range_patterns.rs:19:25
|
LL | let _ = matches!(f, 0 | (1..=10) | 48324730 | (2..=13) | (14..=48324728) | 48324729);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=48324730`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:21:25
--> tests/ui/manual_range_patterns.rs:20:25
|
LL | let _ = matches!(f, 0..=1 | 0..=2 | 0..=3);
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `0..=3`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:24:9
--> tests/ui/manual_range_patterns.rs:23:9
|
LL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 => true,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:27:25
--> tests/ui/manual_range_patterns.rs:26:25
|
LL | let _ = matches!(f, -1 | -5 | 3 | -2 | -4 | -3 | 0 | 1 | 2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-5..=3`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:29:25
--> tests/ui/manual_range_patterns.rs:28:25
|
LL | let _ = matches!(f, -1_000_000..=1_000_000 | -1_000_001 | 1_000_001);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-1_000_001..=1_000_001`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:32:17
--> tests/ui/manual_range_patterns.rs:31:17
|
LL | matches!(f, 0x00 | 0x01 | 0x02 | 0x03);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0x00..=0x03`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:33:17
--> tests/ui/manual_range_patterns.rs:32:17
|
LL | matches!(f, 0x00..=0x05 | 0x06 | 0x07);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `0x00..=0x07`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:34:17
--> tests/ui/manual_range_patterns.rs:33:17
|
LL | matches!(f, -0x09 | -0x08 | -0x07..=0x00);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `-0x09..=0x00`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:36:17
--> tests/ui/manual_range_patterns.rs:35:17
|
LL | matches!(f, 0..5 | 5);
| ^^^^^^^^ help: try: `0..=5`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:37:17
--> tests/ui/manual_range_patterns.rs:36:17
|
LL | matches!(f, 0 | 1..5);
| ^^^^^^^^ help: try: `0..5`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:39:17
--> tests/ui/manual_range_patterns.rs:38:17
|
LL | matches!(f, 0..=5 | 6..10);
| ^^^^^^^^^^^^^ help: try: `0..10`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:40:17
--> tests/ui/manual_range_patterns.rs:39:17
|
LL | matches!(f, 0..5 | 5..=10);
| ^^^^^^^^^^^^^ help: try: `0..=10`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:41:17
--> tests/ui/manual_range_patterns.rs:40:17
|
LL | matches!(f, 5..=10 | 0..5);
| ^^^^^^^^^^^^^ help: try: `0..=10`
error: this OR pattern can be rewritten using a range
--> tests/ui/manual_range_patterns.rs:45:26
--> tests/ui/manual_range_patterns.rs:44:26
|
LL | matches!($e, 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `1..=10`

View file

@ -1,4 +1,3 @@
#![feature(exclusive_range_pattern)]
#![warn(clippy::match_overlapping_arm)]
#![allow(clippy::redundant_pattern_matching)]
#![allow(clippy::if_same_then_else, clippy::equatable_if_let, clippy::needless_if)]

View file

@ -1,11 +1,11 @@
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:12:9
--> tests/ui/match_overlapping_arm.rs:11:9
|
LL | 0..=10 => println!("0..=10"),
| ^^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:14:9
--> tests/ui/match_overlapping_arm.rs:13:9
|
LL | 0..=11 => println!("0..=11"),
| ^^^^^^
@ -13,85 +13,85 @@ LL | 0..=11 => println!("0..=11"),
= help: to override `-D warnings` add `#[allow(clippy::match_overlapping_arm)]`
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:19:9
--> tests/ui/match_overlapping_arm.rs:18:9
|
LL | 0..=5 => println!("0..=5"),
| ^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:22:9
--> tests/ui/match_overlapping_arm.rs:21:9
|
LL | FOO..=11 => println!("FOO..=11"),
| ^^^^^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:57:9
--> tests/ui/match_overlapping_arm.rs:56:9
|
LL | 0..11 => println!("0..11"),
| ^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:59:9
--> tests/ui/match_overlapping_arm.rs:58:9
|
LL | 0..=11 => println!("0..=11"),
| ^^^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:83:9
--> tests/ui/match_overlapping_arm.rs:82:9
|
LL | 0..=10 => println!("0..=10"),
| ^^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:82:9
--> tests/ui/match_overlapping_arm.rs:81:9
|
LL | 5..14 => println!("5..14"),
| ^^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:89:9
--> tests/ui/match_overlapping_arm.rs:88:9
|
LL | 0..7 => println!("0..7"),
| ^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:91:9
--> tests/ui/match_overlapping_arm.rs:90:9
|
LL | 0..=10 => println!("0..=10"),
| ^^^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:102:9
--> tests/ui/match_overlapping_arm.rs:101:9
|
LL | ..=23 => println!("..=23"),
| ^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:104:9
--> tests/ui/match_overlapping_arm.rs:103:9
|
LL | ..26 => println!("..26"),
| ^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:112:9
--> tests/ui/match_overlapping_arm.rs:111:9
|
LL | 21..=30 => (),
| ^^^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:114:9
--> tests/ui/match_overlapping_arm.rs:113:9
|
LL | 21..=40 => (),
| ^^^^^^^
error: some ranges overlap
--> tests/ui/match_overlapping_arm.rs:127:9
--> tests/ui/match_overlapping_arm.rs:126:9
|
LL | 0..=0x0000_0000_0000_00ff => (),
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: overlaps with this
--> tests/ui/match_overlapping_arm.rs:129:9
--> tests/ui/match_overlapping_arm.rs:128:9
|
LL | 0..=0x0000_0000_0000_ffff => (),
| ^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
#![feature(exclusive_range_pattern)]
#![allow(clippy::match_same_arms, dead_code)]
#![warn(clippy::match_wild_err_arm)]

View file

@ -1,5 +1,5 @@
error: `Err(_)` matches all errors
--> tests/ui/match_wild_err_arm.rs:24:9
--> tests/ui/match_wild_err_arm.rs:23:9
|
LL | Err(_) => panic!("err"),
| ^^^^^^
@ -9,7 +9,7 @@ LL | Err(_) => panic!("err"),
= help: to override `-D warnings` add `#[allow(clippy::match_wild_err_arm)]`
error: `Err(_)` matches all errors
--> tests/ui/match_wild_err_arm.rs:32:9
--> tests/ui/match_wild_err_arm.rs:31:9
|
LL | Err(_) => panic!(),
| ^^^^^^
@ -17,7 +17,7 @@ LL | Err(_) => panic!(),
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
error: `Err(_)` matches all errors
--> tests/ui/match_wild_err_arm.rs:40:9
--> tests/ui/match_wild_err_arm.rs:39:9
|
LL | Err(_) => {
| ^^^^^^
@ -25,7 +25,7 @@ LL | Err(_) => {
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
error: `Err(_e)` matches all errors
--> tests/ui/match_wild_err_arm.rs:50:9
--> tests/ui/match_wild_err_arm.rs:49:9
|
LL | Err(_e) => panic!(),
| ^^^^^^^