Use symbols instead of strings
This commit is contained in:
parent
42480fd031
commit
b2dbda4d48
82 changed files with 1206 additions and 700 deletions
|
@ -6,6 +6,7 @@ use syntax_pos::Span;
|
|||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::{in_macro_or_desugar, is_direct_expn_of, span_help_and_lint};
|
||||
use crate::utils::sym;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
|
||||
|
@ -40,9 +41,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
|
|||
!in_macro_or_desugar(span)
|
||||
};
|
||||
if_chain! {
|
||||
if let Some(assert_span) = is_direct_expn_of(e.span, "assert");
|
||||
if let Some(assert_span) = is_direct_expn_of(e.span, *sym::assert);
|
||||
if !in_macro_or_desugar(assert_span)
|
||||
|| is_direct_expn_of(assert_span, "debug_assert")
|
||||
|| is_direct_expn_of(assert_span, *sym::debug_assert)
|
||||
.map_or(false, debug_assert_not_in_macro_or_desugar);
|
||||
if let ExprKind::Unary(_, ref lit) = e.node;
|
||||
if let Some(bool_const) = constant(cx, cx.tables, lit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue