]> git.lizzy.rs Git - rust.git/blob - src/docs/manual_str_repeat.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / manual_str_repeat.txt
1 ### What it does
2 Checks for manual implementations of `str::repeat`
3
4 ### Why is this bad?
5 These are both harder to read, as well as less performant.
6
7 ### Example
8 ```
9 let x: String = std::iter::repeat('x').take(10).collect();
10 ```
11
12 Use instead:
13 ```
14 let x: String = "x".repeat(10);
15 ```