Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
Replace some `std::iter::repeat` with `str::repeat` I noticed that there were some instances where `std::iter::repeat` would be used to repeat a string or a char to take a specific count of it and then collect it into a `String` when `str::repeat` is actually much faster and better for that. See also: https://github.com/rust-lang/rust-clippy/issues/7260.
This commit is contained in:
commit
e82b65026d
2 changed files with 2 additions and 4 deletions
|
@ -849,7 +849,7 @@ fn missing_items_err(
|
|||
// Obtain the level of indentation ending in `sugg_sp`.
|
||||
let indentation = tcx.sess.source_map().span_to_margin(sugg_sp).unwrap_or(0);
|
||||
// Make the whitespace that will make the suggestion have the right indentation.
|
||||
let padding: String = std::iter::repeat(" ").take(indentation).collect();
|
||||
let padding: String = " ".repeat(indentation);
|
||||
|
||||
for trait_item in missing_items {
|
||||
let snippet = suggestion_signature(&trait_item, tcx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue