diff options
Diffstat (limited to 'src/tools/clippy/src/docs/manual_str_repeat.txt')
-rw-r--r-- | src/tools/clippy/src/docs/manual_str_repeat.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/manual_str_repeat.txt b/src/tools/clippy/src/docs/manual_str_repeat.txt new file mode 100644 index 000000000..1d4a7a48e --- /dev/null +++ b/src/tools/clippy/src/docs/manual_str_repeat.txt @@ -0,0 +1,15 @@ +### 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); +```
\ No newline at end of file |