diff options
| author | J-ZhengLi <lizheng135@huawei.com> | 2023-09-12 17:18:39 +0800 |
|---|---|---|
| committer | J-ZhengLi <lizheng135@huawei.com> | 2023-09-12 17:18:39 +0800 |
| commit | 22ba7925d6e7b08fe84ff315b95e2bffd058275f (patch) | |
| tree | 04205c28b0e5fdd8e5cc9630f4c0b0047f75b373 | |
| parent | 438f934f1c330cc43693a2b9ca404f3c704c2ca1 (diff) | |
| download | rust-22ba7925d6e7b08fe84ff315b95e2bffd058275f.tar.gz rust-22ba7925d6e7b08fe84ff315b95e2bffd058275f.zip | |
Update clippy_lints/src/option_if_let_else.rs
Co-authored-by: Samuel Tardieu <sam@rfc1149.net>
| -rw-r--r-- | clippy_lints/src/option_if_let_else.rs | 8 |
1 files 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)> { |
