@@ -7,7 +7,7 @@ use clippy_utils::{
7
7
} ;
8
8
use rustc_errors:: MultiSpan ;
9
9
use rustc_hir:: LangItem :: OptionNone ;
10
- use rustc_hir:: { Arm , Expr , Guard , HirId , Let , Pat , PatKind } ;
10
+ use rustc_hir:: { Arm , Expr , HirId , Pat , PatKind } ;
11
11
use rustc_lint:: LateContext ;
12
12
use rustc_span:: Span ;
13
13
@@ -16,7 +16,7 @@ use super::COLLAPSIBLE_MATCH;
16
16
pub ( super ) fn check_match < ' tcx > ( cx : & LateContext < ' tcx > , arms : & ' tcx [ Arm < ' _ > ] ) {
17
17
if let Some ( els_arm) = arms. iter ( ) . rfind ( |arm| arm_is_wild_like ( cx, arm) ) {
18
18
for arm in arms {
19
- check_arm ( cx, true , arm. pat , arm. body , arm. guard . as_ref ( ) , Some ( els_arm. body ) ) ;
19
+ check_arm ( cx, true , arm. pat , arm. body , arm. guard , Some ( els_arm. body ) ) ;
20
20
}
21
21
}
22
22
}
@@ -35,7 +35,7 @@ fn check_arm<'tcx>(
35
35
outer_is_match : bool ,
36
36
outer_pat : & ' tcx Pat < ' tcx > ,
37
37
outer_then_body : & ' tcx Expr < ' tcx > ,
38
- outer_guard : Option < & ' tcx Guard < ' tcx > > ,
38
+ outer_guard : Option < & ' tcx Expr < ' tcx > > ,
39
39
outer_else_body : Option < & ' tcx Expr < ' tcx > > ,
40
40
) {
41
41
let inner_expr = peel_blocks_with_stmt ( outer_then_body) ;
@@ -71,7 +71,7 @@ fn check_arm<'tcx>(
71
71
// the binding must not be used in the if guard
72
72
&& outer_guard. map_or (
73
73
true ,
74
- |( Guard :: If ( e ) | Guard :: IfLet ( Let { init : e , .. } ) ) | !is_local_used ( cx, * e, binding_id)
74
+ |e| !is_local_used ( cx, e, binding_id)
75
75
)
76
76
// ...or anywhere in the inner expression
77
77
&& match inner {
0 commit comments