don't allocate a Vec in an Iterator::chain

This commit is contained in:
Ada Alakbarova 2025-08-03 17:13:54 +02:00
parent 88bcf1ca19
commit 02ebef4c6a
No known key found for this signature in database

View file

@ -202,7 +202,7 @@ fn all_spans_after_expr(cx: &LateContext<'_>, expr: &Expr<'_>) -> Vec<Span> {
.iter()
.skip_while(|inner| inner.hir_id != stmt.hir_id)
.map(stmt_source_span)
.chain(if let Some(e) = block.expr { vec![e.span] } else { vec![] })
.chain(block.expr.map(|e| e.span))
.collect();
}