diff --git a/clippy_lints/src/matches/needless_match.rs b/clippy_lints/src/matches/needless_match.rs
index 0abe6ddda65a..f920ad4651f9 100644
--- a/clippy_lints/src/matches/needless_match.rs
+++ b/clippy_lints/src/matches/needless_match.rs
@@ -99,7 +99,7 @@ fn check_if_let(cx: &LateContext<'_>, if_let: &higher::IfLet<'_>) -> bool {
if let ExprKind::Path(ref qpath) = ret.kind {
return is_lang_ctor(cx, qpath, OptionNone) || eq_expr_value(cx, if_let.let_expr, ret);
}
- return true;
+ return false;
}
return eq_expr_value(cx, if_let.let_expr, ret);
}
diff --git a/tests/ui/needless_match.fixed b/tests/ui/needless_match.fixed
index 9ccccaa1725a..035b6636baf4 100644
--- a/tests/ui/needless_match.fixed
+++ b/tests/ui/needless_match.fixed
@@ -80,6 +80,22 @@ fn if_let_option() {
} else {
None
};
+
+ // Don't trigger
+ let _ = if let Some(a) = Some(1) {
+ Some(a)
+ } else {
+ Some(2)
+ };
+}
+
+fn if_let_option_result() -> Result<(), ()> {
+ fn f(x: i32) -> Result