literal_representation: Delay macro check.

This commit is contained in:
Jason Newcomb 2024-06-12 23:28:30 -04:00
parent 15f640a7cb
commit c0fa6a92f0

View File

@ -233,11 +233,9 @@ impl_lint_pass!(LiteralDigitGrouping => [
impl EarlyLintPass for LiteralDigitGrouping { impl EarlyLintPass for LiteralDigitGrouping {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if in_external_macro(cx.sess(), expr.span) { if let ExprKind::Lit(lit) = expr.kind
return; && !in_external_macro(cx.sess(), expr.span)
} {
if let ExprKind::Lit(lit) = expr.kind {
self.check_lit(cx, lit, expr.span); self.check_lit(cx, lit, expr.span);
} }
} }
@ -448,11 +446,9 @@ impl_lint_pass!(DecimalLiteralRepresentation => [DECIMAL_LITERAL_REPRESENTATION]
impl EarlyLintPass for DecimalLiteralRepresentation { impl EarlyLintPass for DecimalLiteralRepresentation {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if in_external_macro(cx.sess(), expr.span) { if let ExprKind::Lit(lit) = expr.kind
return; && !in_external_macro(cx.sess(), expr.span)
} {
if let ExprKind::Lit(lit) = expr.kind {
self.check_lit(cx, lit, expr.span); self.check_lit(cx, lit, expr.span);
} }
} }