RS.CLIPPY.MANUAL_STR_REPEAT
Manual implementation of `str::repeat`
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: manual_str_repeat. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for manual implementations of str::repeat
Why is this bad?
These are both harder to read, as well as less performant.
Example
let x: String = std::iter::repeat(\'x\').take(10).collect();
Use instead:
let x: String = "x".repeat(10);
Configuration
-
msrv: The minimum rust version that the project supports. Defaults to therust-versionfield inCargo.toml(default:
current version)