@@ -69,19 +69,16 @@ pub(super) fn check_match<'tcx>(
6969 && let Some ( ( first_arm, middle_arms) ) = arms_without_last. split_first ( )
7070 && !span_contains_comment ( cx. sess ( ) . source_map ( ) , e. span )
7171 && cx. typeck_results ( ) . expr_ty ( e) . is_bool ( )
72- && let ( last_pat, last_expr) = ( last_arm. pat , last_arm. body )
73- && let ( first_attrs, first_expr, first_guard) =
74- ( cx. tcx . hir_attrs ( first_arm. hir_id ) , first_arm. body , first_arm. guard )
75- && let Some ( b0) = find_bool_lit ( first_expr)
76- && let Some ( b1) = find_bool_lit ( last_expr)
72+ && let Some ( b0) = find_bool_lit ( first_arm. body )
73+ && let Some ( b1) = find_bool_lit ( last_arm. body )
7774 && b0 != b1
78- && ( first_guard . is_none ( ) || middle_arms. is_empty ( ) )
79- && first_attrs . is_empty ( )
75+ && ( first_arm . guard . is_none ( ) || middle_arms. is_empty ( ) )
76+ && cx . tcx . hir_attrs ( first_arm . hir_id ) . is_empty ( )
8077 && middle_arms. iter ( ) . all ( |arm| {
8178 cx. tcx . hir_attrs ( arm. hir_id ) . is_empty ( ) && arm. guard . is_none ( ) && find_bool_lit ( arm. body ) == Some ( b0)
8279 } )
8380 {
84- if !is_wild ( last_pat ) {
81+ if !is_wild ( last_arm . pat ) {
8582 return false ;
8683 }
8784
@@ -102,7 +99,7 @@ pub(super) fn check_match<'tcx>(
10299 . map ( |arm| snippet_with_applicability ( cx, arm. pat . span , ".." , & mut applicability) )
103100 . join ( " | " )
104101 } ;
105- let pat_and_guard = if let Some ( g) = first_guard {
102+ let pat_and_guard = if let Some ( g) = first_arm . guard {
106103 format ! (
107104 "{pat} if {}" ,
108105 snippet_with_applicability( cx, g. span, ".." , & mut applicability)
0 commit comments