about summary refs log tree commit diff
diff options
context:
space:
mode:
authordisco07 <koneenok@outlook.fr>2023-05-15 19:43:22 +0200
committerdisco07 <koneenok@outlook.fr>2023-05-15 19:43:22 +0200
commit79a8867addbaad8c2d15adc2accf4c9d7194136a (patch)
treed2e36e9cc3d417f04e8aa9991113a8f619292cd2
parentc53ceba56f0b0ec5d3ee20a19f0f6aace6d26228 (diff)
downloadrust-79a8867addbaad8c2d15adc2accf4c9d7194136a.tar.gz
rust-79a8867addbaad8c2d15adc2accf4c9d7194136a.zip
update test option
-rw-r--r--tests/ui/redundant_pattern_matching_option.fixed5
-rw-r--r--tests/ui/redundant_pattern_matching_option.rs13
-rw-r--r--tests/ui/redundant_pattern_matching_option.stderr28
3 files changed, 22 insertions, 24 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
+error: redundant pattern matching, consider using `is_none()`
+  --> $DIR/redundant_pattern_matching_option.rs:121:5
    |
-LL | /     match y {
-LL | |         Some(_) => true,
-LL | |         _ => false,
+LL | /     match x {
+LL | |         Some(_) => false,
+LL | |         _ => true,
 LL | |     };
-   | |_____^ help: try this: `y.is_some()`
+   | |_____^ help: try this: `x.is_none()`
 
-error: redundant pattern matching, consider using `is_none()`
-  --> $DIR/redundant_pattern_matching_option.rs:127:5
+error: redundant pattern matching, consider using `is_some()`
+  --> $DIR/redundant_pattern_matching_option.rs:126:5
    |
-LL | /     match y {
-LL | |         None => true,
-LL | |         _ => false,
+LL | /     match x {
+LL | |         None => false,
+LL | |         _ => true,
 LL | |     };
-   | |_____^ help: try this: `y.is_none()`
+   | |_____^ help: try this: `x.is_some()`
 
 error: aborting due to 26 previous errors