# indexed_docs: Remove some unnecessary cloning \(\#30236\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4b5158b1685900ba38ca0603ae5291b2572eba53)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4b5158b1685900ba38ca0603ae5291b2572eba53

Requested commit: 4b5158b1685900ba38ca0603ae5291b2572eba53

Commit: 4b5158b1685900ba38ca0603ae5291b2572eba53

Tree: 4b47051b5ee47be579e713a162b28967c9b60e2a

Author: tidely

Committer: GitHub

## Message

```
indexed_docs: Remove some unnecessary cloning (#30236)

Other small patch to reduce allocations.

`.iter().cloned().collect()` calls `Clone` per element, whereas
`.into_iter().collect()` preallocates the `Vec`.

The Zed repo for example has up to 1700 packages on some build
configurations, meaning this change theoretically saves up to 1699
allocations. It's likely the compiler has already optimized this away,
but it's good to be explicit.

Release Notes:

- N/A
```

## Parents

- [a61958e886514396648fbbf1a8b34499c6f63d81](https://git.cafe/gitcafe/zed/commit/a61958e886514396648fbbf1a8b34499c6f63d81?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4b5158b1685900ba38ca0603ae5291b2572eba53?format=markdown)
