Skip to content

Commit f6813b8

Browse files
committed
Remove unnecessary allocation in var_axis
It's possible to use `.mapv_into()` instead of `.mapv()` in this case because the element type doesn't change. Switching to `.mapv_into()` doesn't have a noticeable impact on benchmarks, but it's worth doing anyway just to avoid the extra allocation.
1 parent fbac78b commit f6813b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/numeric/impl_numeric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<A, S, D> ArrayBase<S, D>
177177
of the axis you are computing the variance for!")
178178
} else {
179179
let dof = count - ddof;
180-
sum_sq.mapv(|s| s / dof)
180+
sum_sq.mapv_into(|s| s / dof)
181181
}
182182
}
183183

0 commit comments

Comments
 (0)