@@ -7,7 +7,7 @@ use clippy_utils::{
77} ;
88use rustc_errors:: MultiSpan ;
99use rustc_hir:: LangItem :: OptionNone ;
10- use rustc_hir:: { Arm , Expr , Guard , HirId , Let , Pat , PatKind } ;
10+ use rustc_hir:: { Arm , Expr , HirId , Pat , PatKind } ;
1111use rustc_lint:: LateContext ;
1212use rustc_span:: Span ;
1313
@@ -16,7 +16,7 @@ use super::COLLAPSIBLE_MATCH;
1616pub ( super ) fn check_match < ' tcx > ( cx : & LateContext < ' tcx > , arms : & ' tcx [ Arm < ' _ > ] ) {
1717 if let Some ( els_arm) = arms. iter ( ) . rfind ( |arm| arm_is_wild_like ( cx, arm) ) {
1818 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 ) ) ;
2020 }
2121 }
2222}
@@ -35,7 +35,7 @@ fn check_arm<'tcx>(
3535 outer_is_match : bool ,
3636 outer_pat : & ' tcx Pat < ' tcx > ,
3737 outer_then_body : & ' tcx Expr < ' tcx > ,
38- outer_guard : Option < & ' tcx Guard < ' tcx > > ,
38+ outer_guard : Option < & ' tcx Expr < ' tcx > > ,
3939 outer_else_body : Option < & ' tcx Expr < ' tcx > > ,
4040) {
4141 let inner_expr = peel_blocks_with_stmt ( outer_then_body) ;
@@ -71,7 +71,7 @@ fn check_arm<'tcx>(
7171 // the binding must not be used in the if guard
7272 && outer_guard. map_or (
7373 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)
7575 )
7676 // ...or anywhere in the inner expression
7777 && match inner {
0 commit comments