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:
Stuart Cook
2025-10-09 18:43:26 +11:00
committed by GitHub
16 changed files with 37 additions and 37 deletions

View File

@@ -305,7 +305,7 @@ fn make_elided_region_spans_suggs<'a>(
consecutive_brackets += 1;
} else if let Some(bracket_span) = bracket_span.take() {
let sugg = std::iter::once("<")
.chain(std::iter::repeat(name).take(consecutive_brackets).intersperse(", "))
.chain(std::iter::repeat_n(name, consecutive_brackets).intersperse(", "))
.chain([">"])
.collect();
spans_suggs.push((bracket_span.shrink_to_hi(), sugg));