diff --git a/crates/gpui3/src/elements.rs b/crates/gpui3/src/elements.rs index b2653b22a3..5ee517b6e9 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.rs deleted file mode 100644 index b1cd31a146..0000000000 --- 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, S> { - element: E, - parent_state_type: PhantomData, -} - -impl, S: Send + Sync + 'static> Element for Stateless { - type State = S; - type FrameState = E::FrameState; - - fn layout( - &mut self, - _: &mut Self::State, - cx: &mut crate::ViewContext, - ) -> anyhow::Result<(crate::LayoutId, Self::FrameState)> { - cx.erase_state(|cx| self.element.layout(&mut (), cx)) - } - - fn paint( - &mut self, - bounds: Bounds, - _: &mut Self::State, - frame_state: &mut Self::FrameState, - cx: &mut crate::ViewContext, - ) -> 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.rs index add9615476..8c71284cc9 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(&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> {