Skip to content

Commit 852f1e3

Browse files
Don't emit if literal comes from macro expansion
1 parent 45fdd24 commit 852f1e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clippy_lints/src/literal_string_with_formatting_arg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ declare_lint_pass!(LiteralStringWithFormattingArg => [LITERAL_STRING_WITH_FORMAT
3737

3838
impl EarlyLintPass for LiteralStringWithFormattingArg {
3939
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
40+
if expr.span.from_expansion() {
41+
return;
42+
}
4043
if let ExprKind::Lit(lit) = expr.kind {
4144
let add = match lit.kind {
4245
LitKind::Str => 1,

0 commit comments

Comments
 (0)