11use clippy_utils:: diagnostics:: { span_lint_and_note, span_lint_and_then} ;
2- use clippy_utils:: macros:: macro_backtrace;
32use clippy_utils:: source:: { first_line_of_span, indent_of, reindent_multiline, snippet, snippet_opt} ;
43use clippy_utils:: {
54 eq_expr_value, get_enclosing_block, hash_expr, hash_stmt, if_sequence, is_else_clause, is_lint_allowed,
@@ -13,7 +12,7 @@ use rustc_lint::{LateContext, LateLintPass};
1312use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
1413use rustc_span:: hygiene:: walk_chain;
1514use rustc_span:: source_map:: SourceMap ;
16- use rustc_span:: { sym , BytePos , Span , Symbol } ;
15+ use rustc_span:: { BytePos , Span , Symbol } ;
1716use std:: borrow:: Cow ;
1817
1918declare_clippy_lint ! {
@@ -197,8 +196,6 @@ fn lint_if_same_then_else(cx: &LateContext<'_>, conds: &[&Expr<'_>], blocks: &[&
197196 . enumerate ( )
198197 . fold ( true , |all_eq, ( i, & [ lhs, rhs] ) | {
199198 if eq. eq_block ( lhs, rhs)
200- && !contains_acceptable_macro ( cx, lhs)
201- && !contains_acceptable_macro ( cx, rhs)
202199 && !contains_let ( conds[ i] )
203200 && conds. get ( i + 1 ) . map_or ( true , |e| !contains_let ( e) )
204201 {
@@ -371,37 +368,9 @@ fn eq_stmts(
371368 . all ( |b| get_stmt ( b) . map_or ( false , |s| eq. eq_stmt ( s, stmt) ) )
372369}
373370
374- fn contains_acceptable_macro ( cx : & LateContext < ' _ > , block : & Block < ' _ > ) -> bool {
375- if block. stmts . first ( ) . map_or ( false , |stmt|
376- matches ! (
377- stmt. kind,
378- StmtKind :: Semi ( semi_expr) if acceptable_macro( cx, semi_expr)
379- )
380- ) {
381- return true ;
382- }
383-
384- if let Some ( block_expr) = block. expr
385- && acceptable_macro ( cx, block_expr)
386- {
387- return true
388- }
389371
390- false
391- }
392372
393- fn acceptable_macro ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> bool {
394- if macro_backtrace ( expr. span ) . last ( ) . map_or ( false , |macro_call|
395- matches ! (
396- & cx. tcx. get_diagnostic_name( macro_call. def_id) ,
397- Some ( sym:: todo_macro | sym:: unimplemented_macro)
398- )
399- ) {
400- return true ;
401- }
402373
403- false
404- }
405374
406375fn scan_block_for_eq ( cx : & LateContext < ' _ > , _conds : & [ & Expr < ' _ > ] , block : & Block < ' _ > , blocks : & [ & Block < ' _ > ] ) -> BlockEq {
407376 let mut eq = SpanlessEq :: new ( cx) ;
0 commit comments