Skip to content

Commit

Permalink
Ignore span's parents in collect_ast_format_args/find_format_args
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexendoo committed Sep 8, 2023
1 parent 253f1c4 commit cc8c0e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clippy_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ thread_local! {
/// `FormatArgsCollector`
pub fn collect_ast_format_args(span: Span, format_args: &FormatArgs) {
AST_FORMAT_ARGS.with(|ast_format_args| {
ast_format_args.borrow_mut().insert(span, format_args.clone());
ast_format_args
.borrow_mut()
.insert(span.with_parent(None), format_args.clone());
});
}

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

if let Some(expr) = format_args_expr {
AST_FORMAT_ARGS.with(|ast_format_args| {
ast_format_args.borrow().get(&expr.span).map(callback);
ast_format_args.borrow().get(&expr.span.with_parent(None)).map(callback);
});
}
}
Expand Down

0 comments on commit cc8c0e0

Please sign in to comment.