From 6feef170710b26e9a49f3279d2e3ac133efec59b Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Sat, 1 Jun 2019 07:54:47 +0200 Subject: [PATCH] Fix ellipsis_inclusive_range_patterns lint warnings Changed from `allow` to `warn` in https://github.com/rust-lang/rust/pull/61342 --- tests/ui/match_bool.rs | 4 ++-- tests/ui/match_overlapping_arm.rs | 20 ++++++++++---------- tests/ui/match_overlapping_arm.stderr | 14 +++++++------- tests/ui/single_match.rs | 4 ++-- tests/ui/single_match.stderr | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/ui/match_bool.rs b/tests/ui/match_bool.rs index a7af8ce01083..811aff2a8d40 100644 --- a/tests/ui/match_bool.rs +++ b/tests/ui/match_bool.rs @@ -44,8 +44,8 @@ fn match_bool() { // Not linted match option { - 1...10 => 1, - 11...20 => 2, + 1..=10 => 1, + 11..=20 => 2, _ => 3, }; } diff --git a/tests/ui/match_overlapping_arm.rs b/tests/ui/match_overlapping_arm.rs index 978ac5195d38..a48de440652e 100644 --- a/tests/ui/match_overlapping_arm.rs +++ b/tests/ui/match_overlapping_arm.rs @@ -8,33 +8,33 @@ fn overlapping() { const FOO: u64 = 2; match 42 { - 0...10 => println!("0 ... 10"), - 0...11 => println!("0 ... 11"), + 0..=10 => println!("0 ... 10"), + 0..=11 => println!("0 ... 11"), _ => (), } match 42 { - 0...5 => println!("0 ... 5"), - 6...7 => println!("6 ... 7"), - FOO...11 => println!("0 ... 11"), + 0..=5 => println!("0 ... 5"), + 6..=7 => println!("6 ... 7"), + FOO..=11 => println!("0 ... 11"), _ => (), } match 42 { 2 => println!("2"), - 0...5 => println!("0 ... 5"), + 0..=5 => println!("0 ... 5"), _ => (), } match 42 { 2 => println!("2"), - 0...2 => println!("0 ... 2"), + 0..=2 => println!("0 ... 2"), _ => (), } match 42 { - 0...10 => println!("0 ... 10"), - 11...50 => println!("11 ... 50"), + 0..=10 => println!("0 ... 10"), + 11..=50 => println!("11 ... 50"), _ => (), } @@ -52,7 +52,7 @@ fn overlapping() { match 42 { 0..11 => println!("0 .. 11"), - 0...11 => println!("0 ... 11"), + 0..=11 => println!("0 ... 11"), _ => (), } diff --git a/tests/ui/match_overlapping_arm.stderr b/tests/ui/match_overlapping_arm.stderr index 14eb378141b9..dcd42fca7b46 100644 --- a/tests/ui/match_overlapping_arm.stderr +++ b/tests/ui/match_overlapping_arm.stderr @@ -1,32 +1,32 @@ error: some ranges overlap --> $DIR/match_overlapping_arm.rs:11:9 | -LL | 0...10 => println!("0 ... 10"), +LL | 0..=10 => println!("0 ... 10"), | ^^^^^^ | = note: `-D clippy::match-overlapping-arm` implied by `-D warnings` note: overlaps with this --> $DIR/match_overlapping_arm.rs:12:9 | -LL | 0...11 => println!("0 ... 11"), +LL | 0..=11 => println!("0 ... 11"), | ^^^^^^ error: some ranges overlap --> $DIR/match_overlapping_arm.rs:17:9 | -LL | 0...5 => println!("0 ... 5"), +LL | 0..=5 => println!("0 ... 5"), | ^^^^^ | note: overlaps with this --> $DIR/match_overlapping_arm.rs:19:9 | -LL | FOO...11 => println!("0 ... 11"), +LL | FOO..=11 => println!("0 ... 11"), | ^^^^^^^^ error: some ranges overlap --> $DIR/match_overlapping_arm.rs:25:9 | -LL | 0...5 => println!("0 ... 5"), +LL | 0..=5 => println!("0 ... 5"), | ^^^^^ | note: overlaps with this @@ -38,7 +38,7 @@ LL | 2 => println!("2"), error: some ranges overlap --> $DIR/match_overlapping_arm.rs:31:9 | -LL | 0...2 => println!("0 ... 2"), +LL | 0..=2 => println!("0 ... 2"), | ^^^^^ | note: overlaps with this @@ -56,7 +56,7 @@ LL | 0..11 => println!("0 .. 11"), note: overlaps with this --> $DIR/match_overlapping_arm.rs:55:9 | -LL | 0...11 => println!("0 ... 11"), +LL | 0..=11 => println!("0 ... 11"), | ^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/single_match.rs b/tests/ui/single_match.rs index 99e88019cb89..980ce9a0fabe 100644 --- a/tests/ui/single_match.rs +++ b/tests/ui/single_match.rs @@ -23,7 +23,7 @@ fn single_match() { let z = (1u8, 1u8); match z { - (2...3, 7...9) => dummy(), + (2..=3, 7..=9) => dummy(), _ => {}, }; @@ -35,7 +35,7 @@ fn single_match() { // Not linted (no block with statements in the single arm) match z { - (2...3, 7...9) => println!("{:?}", z), + (2..=3, 7..=9) => println!("{:?}", z), _ => println!("nope"), } } diff --git a/tests/ui/single_match.stderr b/tests/ui/single_match.stderr index 445f702d0cea..80ddeabdb2fd 100644 --- a/tests/ui/single_match.stderr +++ b/tests/ui/single_match.stderr @@ -33,10 +33,10 @@ error: you seem to be trying to use match for destructuring a single pattern. Co --> $DIR/single_match.rs:25:5 | LL | / match z { -LL | | (2...3, 7...9) => dummy(), +LL | | (2..=3, 7..=9) => dummy(), LL | | _ => {}, LL | | }; - | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }` + | |_____^ help: try this: `if let (2..=3, 7..=9) = z { dummy() }` error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` --> $DIR/single_match.rs:54:5