Files
zed/crates
tidely fa6e2e98c7 gpui: Remove .unwrap() on every GPUI entity borrow (#67361)
## Summary

Removes an `unwrap` call during entity borrows. Realistically this only
happens once in each function where the compiler can optimize the later
calls away, but every new function usually still has one of these
unwraps. I didn't take the time to benchmark though, since the effect
will likely be insignificant.

`DropGuard`, Rust 1.100 new feature, allows writing Drop implementations
inline. The differentiating feature for me, is that the function takes a
owned `self`, instead of `&mut self` as in `impl Drop`, this allows us
to get rid of `Option` in a lot of drop implementations, where the type
needs to be moved out during `Drop`.

## Testing

Trivial change once familiar with `DropGuard`.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
- [GPUI] Removed an unwrap during Entity borrow
2026-11-25 06:06:40 +00:00
..
…
2026-11-23 11:19:51 +00:00
…
…