Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove state erasure for now
Nathan Sobo61b8ad38bd02
diff --git a/crates/gpui3/src/elements.rs b/crates/gpui3/src/elements.rsindex b2653b22a32..5ee517b6e91 100644--- a/crates/gpui3/src/elements.rs+++ b/crates/gpui3/src/elements.rs@@ -3,7 +3,6 @@ mod hoverable;mod identified;mod img;mod pressable;-mod stateless;mod svg;mod text;@@ -12,6 +11,5 @@ pub use hoverable::*;pub use identified::*;pub use img::*;pub use pressable::*;-pub use stateless::*;pub use svg::*;pub use text::*;diff --git a/crates/gpui3/src/elements/stateless.rs b/crates/gpui3/src/elements/stateless.rsdeleted file mode 100644index b1cd31a146b..00000000000--- a/crates/gpui3/src/elements/stateless.rs+++ /dev/null@@ -1,30 +0,0 @@-use crate::{Bounds, Element, Pixels};-use std::marker::PhantomData;--pub struct Stateless<E: Element<State = ()>, S> {- element: E,- parent_state_type: PhantomData<S>,-}--impl<E: Element<State = ()>, S: Send + Sync + 'static> Element for Stateless<E, S> {- type State = S;- type FrameState = E::FrameState;-- fn layout(- &mut self,- _: &mut Self::State,- cx: &mut crate::ViewContext<Self::State>,- ) -> anyhow::Result<(crate::LayoutId, Self::FrameState)> {- cx.erase_state(|cx| self.element.layout(&mut (), cx))- }-- fn paint(- &mut self,- bounds: Bounds<Pixels>,- _: &mut Self::State,- frame_state: &mut Self::FrameState,- cx: &mut crate::ViewContext<Self::State>,- ) -> anyhow::Result<()> {- cx.erase_state(|cx| self.element.paint(bounds, &mut (), frame_state, cx))- }-}diff --git a/crates/gpui3/src/window.rs b/crates/gpui3/src/window.rsindex add96154765..8c71284cc93 100644--- a/crates/gpui3/src/window.rs+++ b/crates/gpui3/src/window.rs@@ -926,16 +926,6 @@ impl<'a, 'w, S: Send + Sync + 'static> ViewContext<'a, 'w, S> {})});}-- pub(crate) fn erase_state<R>(&mut self, f: impl FnOnce(&mut ViewContext<()>) -> R) -> R {- let entity_id = self.unit_entity.id;- let mut cx = ViewContext::mutable(- &mut *self.window_cx.app,- &mut *self.window_cx.window,- entity_id,- );- f(&mut cx)- }}impl<'a, 'w, S> Context for ViewContext<'a, 'w, S> {