From 22ba7925d6e7b08fe84ff315b95e2bffd058275f Mon Sep 17 00:00:00 2001 From: J-ZhengLi Date: Tue, 12 Sep 2023 17:18:39 +0800 Subject: [PATCH] Update clippy_lints/src/option_if_let_else.rs Co-authored-by: Samuel Tardieu --- clippy_lints/src/option_if_let_else.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clippy_lints/src/option_if_let_else.rs b/clippy_lints/src/option_if_let_else.rs index 156b95d644a..f94dbb40be7 100644 --- a/clippy_lints/src/option_if_let_else.rs +++ b/clippy_lints/src/option_if_let_else.rs @@ -197,12 +197,10 @@ fn try_get_option_occurrence<'tcx>( /// Gets the call expr iff it does not have any args and was not from macro expansion. fn try_get_argless_call_expr<'tcx>(expr: &Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> { - if !expr.span.from_expansion() && - let ExprKind::Call(call_expr, []) = expr.kind - { - return Some(call_expr); + match expr.kind { + ExprKind::Call(call_expr, []) if !expr.span.from_expansion() => Some(call_expr), + _ => None, } - None } fn try_get_inner_pat_and_is_result<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'tcx>) -> Option<(&'tcx Pat<'tcx>, bool)> {