Fix wrong spans with external macros in the dropping_copy_types lint

This commit is contained in:
Urgau
2025-08-15 11:59:23 +02:00
parent 8800ec1665
commit ae4eeb9299
4 changed files with 22 additions and 2 deletions

View File

@@ -151,7 +151,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
&& let Node::Stmt(stmt) = node
&& let StmtKind::Semi(e) = stmt.kind
&& e.hir_id == expr.hir_id
&& let Some(arg_span) = arg.span.find_ancestor_inside(expr.span)
&& let Some(arg_span) = arg.span.find_ancestor_inside_same_ctxt(expr.span)
{
UseLetUnderscoreIgnoreSuggestion::Suggestion {
start_span: expr.span.shrink_to_lo().until(arg_span),