[slow_vector_initialization]: use the source span of vec![] macro

This commit is contained in:
y21 2023-09-02 15:46:15 +02:00
parent b9906aca5a
commit 78983d9e3f

View File

@ -205,7 +205,7 @@ fn emit_lint(cx: &LateContext<'_>, slow_fill: &Expr<'_>, vec_alloc: &VecAllocati
span_lint_and_then(cx, SLOW_VECTOR_INITIALIZATION, slow_fill.span, msg, |diag| {
diag.span_suggestion(
vec_alloc.allocation_expr.span,
vec_alloc.allocation_expr.span.source_callsite(),
"consider replacing this with",
format!("vec![0; {len_expr}]"),
Applicability::Unspecified,