From 79a8867addbaad8c2d15adc2accf4c9d7194136a Mon Sep 17 00:00:00 2001 From: disco07 Date: Mon, 15 May 2023 19:43:22 +0200 Subject: [PATCH] update test option --- .../redundant_pattern_matching_option.fixed | 5 ++- tests/ui/redundant_pattern_matching_option.rs | 13 ++++---- .../redundant_pattern_matching_option.stderr | 32 +++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/tests/ui/redundant_pattern_matching_option.fixed b/tests/ui/redundant_pattern_matching_option.fixed index 94c89049189..accdf1da9dd 100644 --- a/tests/ui/redundant_pattern_matching_option.fixed +++ b/tests/ui/redundant_pattern_matching_option.fixed @@ -92,15 +92,14 @@ fn issue7921() { fn issue10726() { let x = Some(42); - let y = None::<()>; x.is_some(); x.is_none(); - y.is_some(); + x.is_none(); - y.is_none(); + x.is_some(); // Don't lint match x { diff --git a/tests/ui/redundant_pattern_matching_option.rs b/tests/ui/redundant_pattern_matching_option.rs index 303a0280e9d..ec684bdf71c 100644 --- a/tests/ui/redundant_pattern_matching_option.rs +++ b/tests/ui/redundant_pattern_matching_option.rs @@ -107,7 +107,6 @@ fn issue7921() { fn issue10726() { let x = Some(42); - let y = None::<()>; match x { Some(_) => true, @@ -119,14 +118,14 @@ fn issue10726() { _ => false, }; - match y { - Some(_) => true, - _ => false, + match x { + Some(_) => false, + _ => true, }; - match y { - None => true, - _ => false, + match x { + None => false, + _ => true, }; // Don't lint diff --git a/tests/ui/redundant_pattern_matching_option.stderr b/tests/ui/redundant_pattern_matching_option.stderr index eb4d87ba2b5..a69eb390520 100644 --- a/tests/ui/redundant_pattern_matching_option.stderr +++ b/tests/ui/redundant_pattern_matching_option.stderr @@ -149,7 +149,7 @@ LL | if let None = *&None::<()> {} | -------^^^^--------------- help: try this: `if (&None::<()>).is_none()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching_option.rs:112:5 + --> $DIR/redundant_pattern_matching_option.rs:111:5 | LL | / match x { LL | | Some(_) => true, @@ -158,7 +158,7 @@ LL | | }; | |_____^ help: try this: `x.is_some()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching_option.rs:117:5 + --> $DIR/redundant_pattern_matching_option.rs:116:5 | LL | / match x { LL | | None => true, @@ -166,23 +166,23 @@ LL | | _ => false, LL | | }; | |_____^ help: try this: `x.is_none()` -error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching_option.rs:122:5 - | -LL | / match y { -LL | | Some(_) => true, -LL | | _ => false, -LL | | }; - | |_____^ help: try this: `y.is_some()` - error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching_option.rs:127:5 + --> $DIR/redundant_pattern_matching_option.rs:121:5 | -LL | / match y { -LL | | None => true, -LL | | _ => false, +LL | / match x { +LL | | Some(_) => false, +LL | | _ => true, LL | | }; - | |_____^ help: try this: `y.is_none()` + | |_____^ help: try this: `x.is_none()` + +error: redundant pattern matching, consider using `is_some()` + --> $DIR/redundant_pattern_matching_option.rs:126:5 + | +LL | / match x { +LL | | None => false, +LL | | _ => true, +LL | | }; + | |_____^ help: try this: `x.is_some()` error: aborting due to 26 previous errors