Commit 9cd483d
committed
Auto merge of rust-lang#10786 - mickvangelderen:remove-unnecessary-clone-from-needless-collect-example, r=Alexendoo
Remove unnecessary `clone` from `needless_collect` example
The example for [clippy::needless_collect](https://rust-lang.github.io/rust-clippy/master/#needless_collect) is written as follows:
```rust
let len = iterator.clone().collect::<Vec<_>>().len();
// should be
let len = iterator.count();
```
With this change, the unnecessary `clone()` is removed and the the standard
### Example
```rust
// original
```
Use instead:
```rust
// improved
```
structure is followed.
Discussion: rust-lang/rust-clippy#10784 (comment)
changelog: [`needless_collect`]: Cleaned up the example in the lint documentation.1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3133 | 3133 | | |
3134 | 3134 | | |
3135 | 3135 | | |
3136 | | - | |
3137 | | - | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
3138 | 3141 | | |
3139 | 3142 | | |
3140 | 3143 | | |
| |||
0 commit comments