Rollup merge of #147489 - chenyukang:yukang-prefer-repeat-n, r=Kivooeo,oli-obk
Prefer to use repeat_n over repeat().take()
More from https://github.com/rust-lang/rust/pull/147464, but batch processed with `ast-grep` to find and replace.
second commit add notes for library: affaf532f9
r? ``@RalfJung``
This commit is contained in:
@@ -110,7 +110,7 @@ pub fn get_span_and_frames<'tcx>(
|
||||
if frame.times < 3 {
|
||||
let times = frame.times;
|
||||
frame.times = 0;
|
||||
frames.extend(std::iter::repeat(frame).take(times as usize));
|
||||
frames.extend(std::iter::repeat_n(frame, times as usize));
|
||||
} else {
|
||||
frames.push(frame);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ fn check_validity_requirement_strict<'tcx>(
|
||||
if kind == ValidityRequirement::Zero {
|
||||
cx.write_bytes_ptr(
|
||||
allocated.ptr(),
|
||||
std::iter::repeat(0_u8).take(ty.layout.size().bytes_usize()),
|
||||
std::iter::repeat_n(0_u8, ty.layout.size().bytes_usize()),
|
||||
)
|
||||
.expect("failed to write bytes for zero valid check");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user