@@ -5,7 +5,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
5
5
use syntax_pos:: Span ;
6
6
7
7
use 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} ;
9
9
10
10
declare_clippy_lint ! {
11
11
/// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
@@ -34,16 +34,16 @@ declare_lint_pass!(AssertionsOnConstants => [ASSERTIONS_ON_CONSTANTS]);
34
34
impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for AssertionsOnConstants {
35
35
fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , e : & ' tcx Expr ) {
36
36
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 | {
38
38
is_debug_assert = true ;
39
39
// Check that `debug_assert!` itself is not inside a macro
40
- !in_macro ( span)
40
+ !in_macro_or_desugar ( span)
41
41
} ;
42
42
if_chain ! {
43
43
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)
45
45
|| 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 ) ;
47
47
if let ExprKind :: Unary ( _, ref lit) = e. node;
48
48
if let Some ( bool_const) = constant( cx, cx. tables, lit) ;
49
49
then {
0 commit comments