@@ -127,9 +127,6 @@ impl HirEqInterExpr<'_, '_, '_> {
127127
128128 /// Checks whether two blocks are the same.
129129 fn eq_block ( & mut self , left : & Block < ' _ > , right : & Block < ' _ > ) -> bool {
130- if self . cannot_be_compared_block ( left) || self . cannot_be_compared_block ( right) {
131- return false ;
132- }
133130 match ( left. stmts , left. expr , right. stmts , right. expr ) {
134131 ( [ ] , None , [ ] , None ) => {
135132 // For empty blocks, check to see if the tokens are equal. This will catch the case where a macro
@@ -180,36 +177,13 @@ impl HirEqInterExpr<'_, '_, '_> {
180177 }
181178 }
182179
183- fn cannot_be_compared_block ( & mut self , block : & Block < ' _ > ) -> bool {
184- if block. stmts . last ( ) . map_or ( false , |stmt| {
185- matches ! (
186- stmt. kind,
187- StmtKind :: Semi ( semi_expr) if self . should_ignore( semi_expr)
188- )
189- } ) {
190- return true ;
191- }
192-
193- if let Some ( block_expr) = block. expr
194- && self . should_ignore ( block_expr)
195- {
196- return true
197- }
198-
199- false
200- }
201-
202180 fn should_ignore ( & mut self , expr : & Expr < ' _ > ) -> bool {
203- if macro_backtrace ( expr. span ) . last ( ) . map_or ( false , |macro_call| {
181+ macro_backtrace ( expr. span ) . last ( ) . map_or ( false , |macro_call| {
204182 matches ! (
205183 & self . inner. cx. tcx. get_diagnostic_name( macro_call. def_id) ,
206184 Some ( sym:: todo_macro | sym:: unimplemented_macro)
207185 )
208- } ) {
209- return true ;
210- }
211-
212- false
186+ } )
213187 }
214188
215189 pub fn eq_array_length ( & mut self , left : ArrayLen , right : ArrayLen ) -> bool {
@@ -327,7 +301,8 @@ impl HirEqInterExpr<'_, '_, '_> {
327301 ( & ExprKind :: DropTemps ( le) , & ExprKind :: DropTemps ( re) ) => self . eq_expr ( le, re) ,
328302 _ => false ,
329303 } ;
330- is_eq || self . inner . expr_fallback . as_mut ( ) . map_or ( false , |f| f ( left, right) )
304+ ( is_eq && ( !self . should_ignore ( left) || !self . should_ignore ( right) ) )
305+ || self . inner . expr_fallback . as_mut ( ) . map_or ( false , |f| f ( left, right) )
331306 }
332307
333308 fn eq_exprs ( & mut self , left : & [ Expr < ' _ > ] , right : & [ Expr < ' _ > ] ) -> bool {
0 commit comments