File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -1349,16 +1349,13 @@ pub fn peel_blocks_with_stmt<'a>(mut expr: &'a Expr<'a>) -> &'a Expr<'a> {
13491349
13501350/// Checks if the given expression is the else clause of either an `if` or `if let` expression. 
13511351pub  fn  is_else_clause ( tcx :  TyCtxt < ' _ > ,  expr :  & Expr < ' _ > )  -> bool  { 
1352-     let  mut  iter = tcx. hir_parent_iter ( expr. hir_id ) ; 
1353-     match  iter. next ( )  { 
1354-         Some ( ( 
1355-             _, 
1356-             Node :: Expr ( Expr  { 
1357-                 kind :  ExprKind :: If ( _,  _,  Some ( else_expr) ) , 
1358-                 ..
1359-             } ) , 
1360-         ) )  => else_expr. hir_id  == expr. hir_id , 
1361-         _ => false , 
1352+     if  let  Node :: Expr ( expr)  = tcx. parent_hir_node ( expr. hir_id ) 
1353+         && let  ExprKind :: If ( _,  _,  Some ( else_expr) )  = expr. kind 
1354+         && else_expr. hir_id  == expr. hir_id 
1355+     { 
1356+         true 
1357+     }  else  { 
1358+         false 
13621359    } 
13631360} 
13641361
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments