@@ -247,7 +247,7 @@ impl HirEqInterExpr<'_, '_, '_> {
247247 res
248248 }
249249
250- #[ expect( clippy:: similar_names) ]
250+ #[ expect( clippy:: similar_names, clippy :: too_many_lines ) ]
251251 pub fn eq_expr ( & mut self , left : & Expr < ' _ > , right : & Expr < ' _ > ) -> bool {
252252 if !self . check_ctxt ( left. span . ctxt ( ) , right. span . ctxt ( ) ) {
253253 return false ;
@@ -346,13 +346,53 @@ impl HirEqInterExpr<'_, '_, '_> {
346346 ( & ExprKind :: OffsetOf ( l_container, l_fields) , & ExprKind :: OffsetOf ( r_container, r_fields) ) => {
347347 self . eq_ty ( l_container, r_container) && over ( l_fields, r_fields, |l, r| l. name == r. name )
348348 } ,
349- ( & ExprKind :: ConstBlock ( _) , _)
350- | ( & ExprKind :: Closure ( _) , _)
351- | ( & ExprKind :: Become ( _) , _)
352- | ( & ExprKind :: InlineAsm ( _) , _)
353- | ( & ExprKind :: Yield ( _, _) , _)
354- | ( & ExprKind :: Err ( _) , _) => false ,
355- _ => false ,
349+ (
350+ // Else branches for branches above, grouped as per `match_same_arms`.
351+ | & ExprKind :: AddrOf ( ..)
352+ | & ExprKind :: Array ( ..)
353+ | & ExprKind :: Assign ( ..)
354+ | & ExprKind :: AssignOp ( ..)
355+ | & ExprKind :: Binary ( ..)
356+ | & ExprKind :: Become ( ..)
357+ | & ExprKind :: Block ( ..)
358+ | & ExprKind :: Break ( ..)
359+ | & ExprKind :: Call ( ..)
360+ | & ExprKind :: Cast ( ..)
361+ | & ExprKind :: ConstBlock ( ..)
362+ | & ExprKind :: Continue ( ..)
363+ | & ExprKind :: DropTemps ( ..)
364+ | & ExprKind :: Field ( ..)
365+ | & ExprKind :: Index ( ..)
366+ | & ExprKind :: If ( ..)
367+ | & ExprKind :: Let ( ..)
368+ | & ExprKind :: Lit ( ..)
369+ | & ExprKind :: Loop ( ..)
370+ | & ExprKind :: Match ( ..)
371+ | & ExprKind :: MethodCall ( ..)
372+ | & ExprKind :: OffsetOf ( ..)
373+ | & ExprKind :: Path ( ..)
374+ | & ExprKind :: Repeat ( ..)
375+ | & ExprKind :: Ret ( ..)
376+ | & ExprKind :: Struct ( ..)
377+ | & ExprKind :: Tup ( ..)
378+ | & ExprKind :: Type ( ..)
379+ | & ExprKind :: Unary ( ..)
380+ | & ExprKind :: Yield ( ..)
381+
382+ // --- Special cases that do not have a positive branch.
383+
384+ // `Err` represents an invalid expression, so let's never assume that
385+ // an invalid expressions is equal to anything.
386+ | & ExprKind :: Err ( ..)
387+
388+ // For the time being, we always consider that two closures are unequal.
389+ // This behavior may change in the future.
390+ | & ExprKind :: Closure ( ..)
391+ // For the time being, we always consider that two instances of InlineAsm are different.
392+ // This behavior may change in the future.
393+ | & ExprKind :: InlineAsm ( _)
394+ , _
395+ ) => false ,
356396 } ;
357397 ( is_eq && ( !self . should_ignore ( left) || !self . should_ignore ( right) ) )
358398 || self . inner . expr_fallback . as_mut ( ) . map_or ( false , |f| f ( left, right) )
0 commit comments