Skip to content

Commit cc8c0e0

Browse files
committed
Ignore span's parents in collect_ast_format_args/find_format_args
1 parent 253f1c4 commit cc8c0e0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_utils/src/macros.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ thread_local! {
389389
/// `FormatArgsCollector`
390390
pub fn collect_ast_format_args(span: Span, format_args: &FormatArgs) {
391391
AST_FORMAT_ARGS.with(|ast_format_args| {
392-
ast_format_args.borrow_mut().insert(span, format_args.clone());
392+
ast_format_args
393+
.borrow_mut()
394+
.insert(span.with_parent(None), format_args.clone());
393395
});
394396
}
395397

@@ -414,7 +416,7 @@ pub fn find_format_args(cx: &LateContext<'_>, start: &Expr<'_>, expn_id: ExpnId,
414416

415417
if let Some(expr) = format_args_expr {
416418
AST_FORMAT_ARGS.with(|ast_format_args| {
417-
ast_format_args.borrow().get(&expr.span).map(callback);
419+
ast_format_args.borrow().get(&expr.span.with_parent(None)).map(callback);
418420
});
419421
}
420422
}

0 commit comments

Comments
 (0)