summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs')
-rw-r--r--src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs b/src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs
index 39eb10df8..4d64eafe5 100644
--- a/src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs
+++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_result.rs
@@ -6,6 +6,7 @@
clippy::if_same_then_else,
clippy::match_like_matches_macro,
clippy::needless_bool,
+ clippy::needless_if,
clippy::uninlined_format_args,
clippy::unnecessary_wraps
)]
@@ -56,6 +57,7 @@ fn main() {
issue6067();
issue6065();
issue10726();
+ issue10803();
let _ = if let Ok(_) = gen_res() {
1
@@ -163,3 +165,17 @@ fn issue10726() {
_ => true,
};
}
+
+fn issue10803() {
+ let x: Result<i32, i32> = Ok(42);
+
+ let _ = matches!(x, Ok(_));
+
+ let _ = matches!(x, Err(_));
+
+ // Don't lint
+ let _ = matches!(x, Ok(16));
+
+ // Don't lint
+ let _ = matches!(x, Err(16));
+}