@@ -7,8 +7,8 @@ use rustc_session::declare_lint_pass;
77use rustc_span:: { BytePos , Span } ;
88
99use clippy_utils:: diagnostics:: span_lint;
10+ use clippy_utils:: is_from_proc_macro;
1011use clippy_utils:: mir:: enclosing_mir;
11- use clippy_utils:: source:: snippet_opt;
1212
1313declare_clippy_lint ! {
1414 /// ### What it does
@@ -80,8 +80,8 @@ fn emit_lint(cx: &LateContext<'_>, expr: &Expr<'_>, spans: &[(Span, Option<Strin
8080 }
8181}
8282
83- impl LateLintPass < ' _ > for LiteralStringWithFormattingArg {
84- fn check_expr ( & mut self , cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
83+ impl < ' tcx > LateLintPass < ' tcx > for LiteralStringWithFormattingArg {
84+ fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & Expr < ' tcx > ) {
8585 if expr. span . from_expansion ( ) || expr. span . is_dummy ( ) {
8686 return ;
8787 }
@@ -96,15 +96,10 @@ impl LateLintPass<'_> for LiteralStringWithFormattingArg {
9696 } ,
9797 _ => return ,
9898 } ;
99- let Some ( snippet) = snippet_opt ( cx, expr. span ) else {
100- return ;
101- } ;
102- let fmt_str = symbol. as_str ( ) ;
103- // If the literal has been generated by the macro, the snippet should not contain it,
104- // allowing us to skip it.
105- if !snippet. contains ( fmt_str) {
99+ if is_from_proc_macro ( cx, expr) {
106100 return ;
107101 }
102+ let fmt_str = symbol. as_str ( ) ;
108103 let lo = expr. span . lo ( ) ;
109104 let mut current = fmt_str;
110105 let mut diff_len = 0 ;
0 commit comments