mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
39467cf4b1
Custom elements previously had to hand-write an `IntoElement` impl that just returned `self`. Replace that boilerplate with a blanket `impl<T: Element> IntoElement for T`, and relax the `Element` supertrait bound from `IntoElement` to `Sized`. Any type implementing `Element` is now usable as a child element without extra code. `AnyElement` overrides `into_any` to return `self`, so converting one does not nest a boxed element inside another. To make that easy to notice, the private `AnyElement::new` is renamed to `new_please_call_into_any_to_avoid_double_box`. Remove the now-redundant `IntoElement` impls across gpui and its consumers. ## Testing Manually test your changes; report results, mention platforms if relevant. How can reviewers test this easily? Include setup and steps. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - [GPUI] (breaking) Added blanket impl for `IntoElement` trait with `ElementType = Self` when `Self` implements `Element`. --------- Co-authored-by: Amp <amp@ampcode.com>