Rollup merge of #145430 - Urgau:drop_forget_useless-145427, r=lqd
Fix wrong spans with external macros in the `dropping_copy_types` lint This PR fixes some wrong spans manipulations when external macros are involved. Specifically we didn't make sure the spans had the same context, which kind-of make our spans manipulations go wrong and produce weird spans. We fix that by making sure they have the same context. Fixes https://github.com/rust-lang/rust/issues/145427
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user