summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed')
-rw-r--r--src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed
index a89845c1d..accdf1da9 100644
--- a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed
+++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed
@@ -1,4 +1,4 @@
-// run-rustfix
+//@run-rustfix
#![warn(clippy::all)]
#![warn(clippy::redundant_pattern_matching)]
@@ -46,6 +46,7 @@ fn main() {
let _ = if opt.is_some() { true } else { false };
issue6067();
+ issue10726();
let _ = if gen_opt().is_some() {
1
@@ -54,6 +55,8 @@ fn main() {
} else {
3
};
+
+ if gen_opt().is_some() {}
}
fn gen_opt() -> Option<()> {
@@ -86,3 +89,21 @@ fn issue7921() {
if (&None::<()>).is_none() {}
if (&None::<()>).is_none() {}
}
+
+fn issue10726() {
+ let x = Some(42);
+
+ x.is_some();
+
+ x.is_none();
+
+ x.is_none();
+
+ x.is_some();
+
+ // Don't lint
+ match x {
+ Some(21) => true,
+ _ => false,
+ };
+}