Skip to content

Commit

Permalink
Don't emit if literal comes from macro expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 19, 2024
1 parent 45fdd24 commit 852f1e3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clippy_lints/src/literal_string_with_formatting_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ declare_lint_pass!(LiteralStringWithFormattingArg => [LITERAL_STRING_WITH_FORMAT

impl EarlyLintPass for LiteralStringWithFormattingArg {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if expr.span.from_expansion() {
return;
}
if let ExprKind::Lit(lit) = expr.kind {
let add = match lit.kind {
LitKind::Str => 1,
Expand Down

0 comments on commit 852f1e3

Please sign in to comment.