# Add VecMap::entry_ref \(\#52601\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 54a95e717d4ed1589c9b0e38648f65424defc74b

Requested commit: 54a95e717d4ed1589c9b0e38648f65424defc74b

Commit: 54a95e717d4ed1589c9b0e38648f65424defc74b

Tree: 2defe05f942a136f0ac142f92beb1294280b249e

Author: Eric Holk

Committer: GitHub

## Message

```
Add VecMap::entry_ref (#52601)

Thinking more on #52596, I realized the `entry` method needs a key by
value, which meant we were always cloning a path list even if it was
already in the map. This PR adds an `entry_ref` that takes the key by
reference and delays cloning the key until we know we're going to be
inserting.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
```

## Parents

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

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