@@ -127,9 +127,6 @@ impl HirEqInterExpr<'_, '_, '_> {
127
127
128
128
/// Checks whether two blocks are the same.
129
129
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
- }
133
130
match ( left. stmts , left. expr , right. stmts , right. expr ) {
134
131
( [ ] , None , [ ] , None ) => {
135
132
// 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<'_, '_, '_> {
180
177
}
181
178
}
182
179
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
-
202
180
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| {
204
182
matches ! (
205
183
& self . inner. cx. tcx. get_diagnostic_name( macro_call. def_id) ,
206
184
Some ( sym:: todo_macro | sym:: unimplemented_macro)
207
185
)
208
- } ) {
209
- return true ;
210
- }
211
-
212
- false
186
+ } )
213
187
}
214
188
215
189
pub fn eq_array_length ( & mut self , left : ArrayLen , right : ArrayLen ) -> bool {
@@ -327,7 +301,8 @@ impl HirEqInterExpr<'_, '_, '_> {
327
301
( & ExprKind :: DropTemps ( le) , & ExprKind :: DropTemps ( re) ) => self . eq_expr ( le, re) ,
328
302
_ => false ,
329
303
} ;
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) )
331
306
}
332
307
333
308
fn eq_exprs ( & mut self , left : & [ Expr < ' _ > ] , right : & [ Expr < ' _ > ] ) -> bool {
0 commit comments