From 4c1cba6def2d599c6df0b4aab7ce0b307393e0ec Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 2 May 2023 10:09:57 +0200 Subject: [PATCH] Remove unnecessary `Element` impl for `RootElement` --- crates/gpui/src/elements.rs | 58 ------------------------------------- 1 file changed, 58 deletions(-) diff --git a/crates/gpui/src/elements.rs b/crates/gpui/src/elements.rs index 09b9c40589..dbeb9c218a 100644 --- a/crates/gpui/src/elements.rs +++ b/crates/gpui/src/elements.rs @@ -45,7 +45,6 @@ use std::{ mem, ops::{Deref, DerefMut, Range}, }; -use util::ResultExt; pub trait Element: 'static { type LayoutState; @@ -717,63 +716,6 @@ impl AnyRootElement for RootElement { } } -impl Element for RootElement { - type LayoutState = (); - type PaintState = (); - - fn layout( - &mut self, - constraint: SizeConstraint, - _view: &mut V, - cx: &mut ViewContext, - ) -> (Vector2F, ()) { - let size = AnyRootElement::layout(self, constraint, cx) - .log_err() - .unwrap_or_else(|| Vector2F::zero()); - (size, ()) - } - - fn paint( - &mut self, - scene: &mut SceneBuilder, - bounds: RectF, - visible_bounds: RectF, - _layout: &mut Self::LayoutState, - _view: &mut V, - cx: &mut ViewContext, - ) { - AnyRootElement::paint(self, scene, bounds.origin(), visible_bounds, cx).log_err(); - } - - fn rect_for_text_range( - &self, - range_utf16: Range, - _bounds: RectF, - _visible_bounds: RectF, - _layout: &Self::LayoutState, - _paint: &Self::PaintState, - _view: &V, - cx: &ViewContext, - ) -> Option { - AnyRootElement::rect_for_text_range(self, range_utf16, cx) - .log_err() - .flatten() - } - - fn debug( - &self, - _bounds: RectF, - _layout: &Self::LayoutState, - _paint: &Self::PaintState, - _view: &V, - cx: &ViewContext, - ) -> serde_json::Value { - AnyRootElement::debug(self, cx) - .log_err() - .unwrap_or_default() - } -} - pub trait ParentElement<'a, V: View>: Extend> + Sized { fn add_children>(&mut self, children: impl IntoIterator) { self.extend(children.into_iter().map(|child| child.into_any()));