diff options
Diffstat (limited to 'src/tools/clippy/src/docs/cloned_instead_of_copied.txt')
-rw-r--r-- | src/tools/clippy/src/docs/cloned_instead_of_copied.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/cloned_instead_of_copied.txt b/src/tools/clippy/src/docs/cloned_instead_of_copied.txt new file mode 100644 index 000000000..2f2014d5f --- /dev/null +++ b/src/tools/clippy/src/docs/cloned_instead_of_copied.txt @@ -0,0 +1,16 @@ +### What it does +Checks for usages of `cloned()` on an `Iterator` or `Option` where +`copied()` could be used instead. + +### Why is this bad? +`copied()` is better because it guarantees that the type being cloned +implements `Copy`. + +### Example +``` +[1, 2, 3].iter().cloned(); +``` +Use instead: +``` +[1, 2, 3].iter().copied(); +```
\ No newline at end of file |