@@ -164,6 +164,10 @@ impl<'tcx> LateLintPass<'tcx> for FormatArgs {
164
164
}
165
165
166
166
fn check_uninlined_args ( cx : & LateContext < ' _ > , args : & FormatArgsExpn < ' _ > , call_site : Span ) {
167
+ if args. format_string . span . from_expansion ( ) {
168
+ return ;
169
+ }
170
+
167
171
let mut fixes = Vec :: new ( ) ;
168
172
// If any of the arguments are referenced by an index number,
169
173
// and that argument is not a simple variable and cannot be inlined,
@@ -204,17 +208,17 @@ fn check_one_arg(cx: &LateContext<'_>, param: &FormatParam<'_>, fixes: &mut Vec<
204
208
&& let [ segment] = segments
205
209
{
206
210
let replacement = match param. usage {
207
- FormatParamUsage :: Argument => segment. ident . name . to_string ( ) ,
211
+ FormatParamUsage :: Argument => segment. ident . name . to_string ( ) ,
208
212
FormatParamUsage :: Width => format ! ( "{}$" , segment. ident. name) ,
209
213
FormatParamUsage :: Precision => format ! ( ".{}$" , segment. ident. name) ,
210
- } ;
211
- fixes. push ( ( param. span , replacement) ) ;
212
- let arg_span = expand_past_previous_comma ( cx, * span) ;
213
- fixes. push ( ( arg_span, String :: new ( ) ) ) ;
214
- true // successful inlining, continue checking
215
- } else {
216
- // if we can't inline a numbered argument, we can't continue
217
- param. kind != Numbered
214
+ } ;
215
+ fixes. push ( ( param. span , replacement) ) ;
216
+ let arg_span = expand_past_previous_comma ( cx, * span) ;
217
+ fixes. push ( ( arg_span, String :: new ( ) ) ) ;
218
+ true // successful inlining, continue checking
219
+ } else {
220
+ // if we can't inline a numbered argument, we can't continue
221
+ param. kind != Numbered
218
222
}
219
223
}
220
224
0 commit comments