@@ -5,7 +5,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
55use syntax_pos:: Span ;
66
77use crate :: consts:: { constant, Constant } ;
8- use crate :: utils:: { in_macro , is_direct_expn_of, span_help_and_lint} ;
8+ use crate :: utils:: { in_macro_or_desugar , is_direct_expn_of, span_help_and_lint} ;
99
1010declare_clippy_lint ! {
1111 /// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
@@ -34,16 +34,16 @@ declare_lint_pass!(AssertionsOnConstants => [ASSERTIONS_ON_CONSTANTS]);
3434impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for AssertionsOnConstants {
3535 fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , e : & ' tcx Expr ) {
3636 let mut is_debug_assert = false ;
37- let debug_assert_not_in_macro = |span : Span | {
37+ let debug_assert_not_in_macro_or_desugar = |span : Span | {
3838 is_debug_assert = true ;
3939 // Check that `debug_assert!` itself is not inside a macro
40- !in_macro ( span)
40+ !in_macro_or_desugar ( span)
4141 } ;
4242 if_chain ! {
4343 if let Some ( assert_span) = is_direct_expn_of( e. span, "assert" ) ;
44- if !in_macro ( assert_span)
44+ if !in_macro_or_desugar ( assert_span)
4545 || is_direct_expn_of( assert_span, "debug_assert" )
46- . map_or( false , debug_assert_not_in_macro ) ;
46+ . map_or( false , debug_assert_not_in_macro_or_desugar ) ;
4747 if let ExprKind :: Unary ( _, ref lit) = e. node;
4848 if let Some ( bool_const) = constant( cx, cx. tables, lit) ;
4949 then {
0 commit comments