diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-06-12 23:28:30 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2024-07-07 18:06:27 -0400 |
| commit | c0fa6a92f0a4a217bddb088090b12fffa9a29f72 (patch) | |
| tree | bf55212cae1e6cedaaf2bd7f9865c85c81344b86 | |
| parent | 15f640a7cbc7c30bc04010e843ff58f3d6ea0ddd (diff) | |
| download | rust-c0fa6a92f0a4a217bddb088090b12fffa9a29f72.tar.gz rust-c0fa6a92f0a4a217bddb088090b12fffa9a29f72.zip | |
`literal_representation`: Delay macro check.
| -rw-r--r-- | clippy_lints/src/literal_representation.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index d2a140a36a8..7481543941a 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -233,11 +233,9 @@ impl_lint_pass!(LiteralDigitGrouping => [ impl EarlyLintPass for LiteralDigitGrouping { fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { - if in_external_macro(cx.sess(), expr.span) { - return; - } - - if let ExprKind::Lit(lit) = expr.kind { + if let ExprKind::Lit(lit) = expr.kind + && !in_external_macro(cx.sess(), expr.span) + { self.check_lit(cx, lit, expr.span); } } @@ -448,11 +446,9 @@ impl_lint_pass!(DecimalLiteralRepresentation => [DECIMAL_LITERAL_REPRESENTATION] impl EarlyLintPass for DecimalLiteralRepresentation { fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { - if in_external_macro(cx.sess(), expr.span) { - return; - } - - if let ExprKind::Lit(lit) = expr.kind { + if let ExprKind::Lit(lit) = expr.kind + && !in_external_macro(cx.sess(), expr.span) + { self.check_lit(cx, lit, expr.span); } } |
