prefer repeat_n() over repeat().take()

This commit is contained in:
Ralf Jung
2025-10-08 09:04:22 +02:00
parent 4a54b26d30
commit 70a357a4c6

View File

@@ -878,7 +878,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
.compute_size_in_bytes(layout.size, count)
.ok_or_else(|| err_ub_custom!(fluent::const_eval_size_overflow, name = name))?;
let bytes = std::iter::repeat(byte).take(len.bytes_usize());
let bytes = std::iter::repeat_n(byte, len.bytes_usize());
self.write_bytes_ptr(dst, bytes)
}