From 927278e20d149d9c0c5024e435d10a0bb8d4a9d8 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 26 Oct 2023 11:49:36 +0200 Subject: [PATCH] Remove IntoAnyElement bound from Element trait --- crates/copilot2/src/sign_in.rs | 2 +- crates/storybook2/src/stories/kitchen_sink.rs | 2 +- crates/storybook2/src/stories/scroll.rs | 5 +++-- crates/storybook2/src/stories/z_index.rs | 4 ++-- crates/storybook2/src/storybook2.rs | 4 ++-- crates/ui2/src/components/assistant_panel.rs | 8 ++------ crates/ui2/src/components/breadcrumb.rs | 8 ++------ crates/ui2/src/components/buffer.rs | 12 ++++-------- crates/ui2/src/components/buffer_search.rs | 2 +- crates/ui2/src/components/chat_panel.rs | 10 +++------- crates/ui2/src/components/collab_panel.rs | 8 ++------ crates/ui2/src/components/command_palette.rs | 8 ++------ crates/ui2/src/components/context_menu.rs | 8 ++------ crates/ui2/src/components/copilot.rs | 8 ++------ crates/ui2/src/components/editor_pane.rs | 2 +- crates/ui2/src/components/facepile.rs | 8 ++------ crates/ui2/src/components/icon_button.rs | 2 +- crates/ui2/src/components/keybinding.rs | 10 +++------- .../ui2/src/components/language_selector.rs | 8 ++------ crates/ui2/src/components/list.rs | 19 ++++++++----------- crates/ui2/src/components/modal.rs | 2 +- crates/ui2/src/components/multi_buffer.rs | 8 ++------ .../ui2/src/components/notification_toast.rs | 2 +- .../ui2/src/components/notifications_panel.rs | 8 ++------ crates/ui2/src/components/palette.rs | 10 +++------- crates/ui2/src/components/panel.rs | 8 ++------ crates/ui2/src/components/panes.rs | 2 +- crates/ui2/src/components/player_stack.rs | 2 +- crates/ui2/src/components/project_panel.rs | 8 ++------ crates/ui2/src/components/recent_projects.rs | 8 ++------ crates/ui2/src/components/status_bar.rs | 10 +++++++--- crates/ui2/src/components/tab.rs | 8 ++------ crates/ui2/src/components/tab_bar.rs | 8 ++------ crates/ui2/src/components/terminal.rs | 8 ++------ crates/ui2/src/components/theme_selector.rs | 8 ++------ crates/ui2/src/components/title_bar.rs | 4 ++-- crates/ui2/src/components/toast.rs | 4 ++-- crates/ui2/src/components/toolbar.rs | 8 ++------ crates/ui2/src/components/traffic_lights.rs | 10 +++------- crates/ui2/src/components/workspace.rs | 2 +- crates/ui2/src/elements/avatar.rs | 8 ++------ crates/ui2/src/elements/button.rs | 14 +++----------- crates/ui2/src/elements/details.rs | 8 ++------ crates/ui2/src/elements/icon.rs | 8 ++------ crates/ui2/src/elements/input.rs | 8 ++------ crates/ui2/src/elements/label.rs | 10 +++------- crates/ui2/src/elements/tool_divider.rs | 2 +- crates/ui2/src/story.rs | 6 +++--- 48 files changed, 106 insertions(+), 224 deletions(-) diff --git a/crates/copilot2/src/sign_in.rs b/crates/copilot2/src/sign_in.rs index ab326a88195e610ae264b82f00a227325a5a8ad7..57f248aa52486d8c04672eeef8d33e5acda2a52c 100644 --- a/crates/copilot2/src/sign_in.rs +++ b/crates/copilot2/src/sign_in.rs @@ -106,7 +106,7 @@ // data: &PromptUserDeviceFlow, // style: &theme::Copilot, // cx: &mut ViewContext, -// ) -> impl Element { +// ) -> impl IntoAnyElement { // let copied = cx // .read_from_clipboard() // .map(|item| item.text() == &data.user_code) diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs index 63cb1d0f517335c02ece1c0dbb02066ef9142ffb..fbb4f5099c6937e7eec1c53b17cc179089a139e4 100644 --- a/crates/storybook2/src/stories/kitchen_sink.rs +++ b/crates/storybook2/src/stories/kitchen_sink.rs @@ -16,7 +16,7 @@ impl KitchenSinkStory { view(cx.entity(|cx| Self::new()), Self::render) } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { let element_stories = ElementStory::iter() .map(|selector| selector.story(cx)) .collect::>(); diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs index 67200b52bcce7466939009af36033b1e345beeb8..f589ea7cef9cc9f2c70baa3c464a0be742899a76 100644 --- a/crates/storybook2/src/stories/scroll.rs +++ b/crates/storybook2/src/stories/scroll.rs @@ -1,6 +1,7 @@ use crate::themes::rose_pine; use gpui2::{ - div, px, view, Context, Element, ParentElement, SharedString, Styled, View, WindowContext, + div, px, view, Context, IntoAnyElement, ParentElement, SharedString, Styled, View, + WindowContext, }; use ui::ElementExt; @@ -16,7 +17,7 @@ impl ScrollStory { } } -fn checkerboard(depth: usize) -> impl Element +fn checkerboard(depth: usize) -> impl IntoAnyElement where S: 'static + Send + Sync, { diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs index 39ac6fd6e414649687ef83eaaaa87a1503f715f3..213d7bed4eaf2b504ecbc3baa7f76af699934663 100644 --- a/crates/storybook2/src/stories/z_index.rs +++ b/crates/storybook2/src/stories/z_index.rs @@ -19,7 +19,7 @@ impl ZIndexStory { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title(cx, "z-index")) .child( @@ -102,7 +102,7 @@ impl ZIndexExample { } } - fn render(&mut self, _view: &mut V, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut V, cx: &mut ViewContext) -> impl IntoAnyElement { div() .relative() .size_full() diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs index 107d737ef9273abb806ca7d2abf1a28818fed983..4db1fd434babf2963a774757136aa07dc9a26233 100644 --- a/crates/storybook2/src/storybook2.rs +++ b/crates/storybook2/src/storybook2.rs @@ -10,7 +10,7 @@ use std::sync::Arc; use clap::Parser; use gpui2::{ - div, px, size, view, AnyView, AppContext, Bounds, Context, Element, ViewContext, WindowBounds, + div, px, size, view, AnyView, AppContext, Bounds, Context, ViewContext, WindowBounds, WindowOptions, }; use log::LevelFilter; @@ -107,7 +107,7 @@ impl StoryWrapper { Self { story, theme } } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { themed(self.theme.clone(), cx, |cx| { div() .flex() diff --git a/crates/ui2/src/components/assistant_panel.rs b/crates/ui2/src/components/assistant_panel.rs index 77d29f44f78d0c2aa20f62b79742fc5f9b7f2fbb..1c47bf1a913490d817b48797a1c90b6e1e9bb75a 100644 --- a/crates/ui2/src/components/assistant_panel.rs +++ b/crates/ui2/src/components/assistant_panel.rs @@ -26,7 +26,7 @@ impl AssistantPanel { self } - fn render(&mut self, view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Panel::new(self.id.clone(), cx) .children(vec![div() .flex() @@ -96,11 +96,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, AssistantPanel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/breadcrumb.rs b/crates/ui2/src/components/breadcrumb.rs index 4bd5283db3ca1ba75b05c60bede83ba0c25bb26d..5f4d3cbafe58db2354e2f41262ecc7880481e12d 100644 --- a/crates/ui2/src/components/breadcrumb.rs +++ b/crates/ui2/src/components/breadcrumb.rs @@ -31,11 +31,7 @@ impl Breadcrumb { div().child(" › ").text_color(theme.text_muted) } - fn render( - &mut self, - view_state: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, view_state: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let symbols_len = self.symbols.len(); @@ -106,7 +102,7 @@ mod stories { &mut self, view_state: &mut S, cx: &mut ViewContext, - ) -> impl Element { + ) -> impl IntoAnyElement { let theme = theme(cx); Story::container(cx) diff --git a/crates/ui2/src/components/buffer.rs b/crates/ui2/src/components/buffer.rs index 51f5ea9196568a2cdc5f14978e8e47098146f7a6..7b67afc2b40358e481002e3c959b5d4a5d35c785 100644 --- a/crates/ui2/src/components/buffer.rs +++ b/crates/ui2/src/components/buffer.rs @@ -158,7 +158,7 @@ impl Buffer { self } - fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element { + fn render_row(row: BufferRow, cx: &WindowContext) -> impl IntoAnyElement { let theme = theme(cx); let line_background = if row.current { @@ -208,7 +208,7 @@ impl Buffer { })) } - fn render_rows(&self, cx: &WindowContext) -> Vec> { + fn render_rows(&self, cx: &WindowContext) -> Vec> { match &self.rows { Some(rows) => rows .rows @@ -219,7 +219,7 @@ impl Buffer { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let rows = self.render_rows(cx); @@ -258,11 +258,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); Story::container(cx) diff --git a/crates/ui2/src/components/buffer_search.rs b/crates/ui2/src/components/buffer_search.rs index 3294aec78061f40900ea28deba2052c078d12ce9..e3e92aa073fdedcfee755025a03e7f13a18b00e3 100644 --- a/crates/ui2/src/components/buffer_search.rs +++ b/crates/ui2/src/components/buffer_search.rs @@ -25,7 +25,7 @@ impl BufferSearch { view(cx.entity(|cx| Self::new()), Self::render) } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); h_stack().bg(theme.toolbar).p_2().child( diff --git a/crates/ui2/src/components/chat_panel.rs b/crates/ui2/src/components/chat_panel.rs index b66868138f8de413943519c2aa929dd488ca8519..afb79cc907646e249c7a308573d33b098cebdb47 100644 --- a/crates/ui2/src/components/chat_panel.rs +++ b/crates/ui2/src/components/chat_panel.rs @@ -24,7 +24,7 @@ impl ChatPanel { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .id(self.element_id.clone()) .flex() @@ -88,7 +88,7 @@ impl ChatMessage { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .flex() .flex_col() @@ -129,11 +129,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, ChatPanel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/collab_panel.rs b/crates/ui2/src/components/collab_panel.rs index 40276f20b3577c207038adc44fc4a3c61c256602..d7dfcdceab465921a0e37c5f8c0090dba95d8b1f 100644 --- a/crates/ui2/src/components/collab_panel.rs +++ b/crates/ui2/src/components/collab_panel.rs @@ -19,7 +19,7 @@ impl CollabPanel { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() @@ -110,11 +110,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, CollabPanel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/command_palette.rs b/crates/ui2/src/components/command_palette.rs index 036a41e0b90ac9765d76bf2a977eb3debdd63035..b2418813d5f9b4a64a4fe3e6ef3491e178db41f8 100644 --- a/crates/ui2/src/components/command_palette.rs +++ b/crates/ui2/src/components/command_palette.rs @@ -17,7 +17,7 @@ impl CommandPalette { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div().id(self.id.clone()).child( Palette::new("palette") .items(example_editor_actions()) @@ -49,11 +49,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, CommandPalette>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs index fb076dc9fe4f664ce07aca6fe53fac6d0b3cf3b2..ea12cdcfc58648409a1e0afa7d92686601ddfc73 100644 --- a/crates/ui2/src/components/context_menu.rs +++ b/crates/ui2/src/components/context_menu.rs @@ -42,7 +42,7 @@ impl ContextMenu { items: items.into_iter().collect(), } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() @@ -85,11 +85,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, ContextMenu>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/copilot.rs b/crates/ui2/src/components/copilot.rs index 8c51b1f4ebd91fd05d3f8cc9a2d58ec11d517c85..b1f41078e8bbd55b5520db3488204d15ce8d0fd5 100644 --- a/crates/ui2/src/components/copilot.rs +++ b/crates/ui2/src/components/copilot.rs @@ -16,7 +16,7 @@ impl CopilotModal { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div().id(self.id.clone()).child( Modal::new("some-id") .title("Connect Copilot to Zed") @@ -47,11 +47,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, CopilotModal>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/editor_pane.rs b/crates/ui2/src/components/editor_pane.rs index b641c86f7e21f0bf3300b675c554366b58101a57..3fc41d7db6c168df9c4ad34e2f6bca3e150a7b21 100644 --- a/crates/ui2/src/components/editor_pane.rs +++ b/crates/ui2/src/components/editor_pane.rs @@ -49,7 +49,7 @@ impl EditorPane { ) } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { v_stack() .w_full() .h_full() diff --git a/crates/ui2/src/components/facepile.rs b/crates/ui2/src/components/facepile.rs index b75ef328f334f29d6bfedb79cec1f53bd5946d9d..0763b34b03f02aba0ec9114a28b050cffa78317a 100644 --- a/crates/ui2/src/components/facepile.rs +++ b/crates/ui2/src/components/facepile.rs @@ -17,7 +17,7 @@ impl Facepile { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let player_count = self.players.len(); let player_list = self.players.iter().enumerate().map(|(ix, player)| { let isnt_last = ix < player_count - 1; @@ -51,11 +51,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let players = static_players(); Story::container(cx) diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rs index 77d248e9ee1c7f737b8bf4d9270afe0c5bd5a8b3..63158421930a1df3effe8a48afa396c423e9e25f 100644 --- a/crates/ui2/src/components/icon_button.rs +++ b/crates/ui2/src/components/icon_button.rs @@ -68,7 +68,7 @@ impl IconButton { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let icon_color = match (self.state, self.color) { diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs index 25de760cabe0ea976de1f9d7e5fbabff9adbc436..78d05e4f3039ac52938b812c1efd004637982c40 100644 --- a/crates/ui2/src/components/keybinding.rs +++ b/crates/ui2/src/components/keybinding.rs @@ -34,7 +34,7 @@ impl Keybinding { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .flex() .gap_2() @@ -68,7 +68,7 @@ impl Key { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -185,11 +185,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let all_modifier_permutations = ModifierKey::iter().permutations(2); Story::container(cx) diff --git a/crates/ui2/src/components/language_selector.rs b/crates/ui2/src/components/language_selector.rs index dbead8467e068cb2e9d7e4b308de1884f9f1e43a..0aea61b9a03203692a95f5618d98091d96edf7cf 100644 --- a/crates/ui2/src/components/language_selector.rs +++ b/crates/ui2/src/components/language_selector.rs @@ -17,7 +17,7 @@ impl LanguageSelector { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div().id(self.id.clone()).child( Palette::new("palette") .items(vec![ @@ -60,11 +60,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, LanguageSelector>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index 0c41671247cc7ccff6765ff55d98ca70b6d1f6db..b7557b44d4483eafddb0711b0692670e9f6950a1 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -92,7 +92,7 @@ impl ListHeader { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let is_toggleable = self.toggleable != Toggleable::NotToggleable; @@ -157,7 +157,7 @@ impl ListSubHeader { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { h_stack().flex_1().w_full().relative().py_1().child( div() .h_6() @@ -230,7 +230,7 @@ impl From> for ListItem { } impl ListItem { - fn render(&mut self, view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { match self { ListItem::Entry(entry) => div().child(entry.render(view, cx)), ListItem::Separator(separator) => div().child(separator.render(view, cx)), @@ -344,10 +344,7 @@ impl ListEntry { } } - fn disclosure_control( - &mut self, - cx: &mut ViewContext, - ) -> Option> { + fn disclosure_control(&mut self, cx: &mut ViewContext) -> Option> { let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle { IconElement::new(Icon::ChevronDown) } else { @@ -367,7 +364,7 @@ impl ListEntry { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let settings = user_settings(cx); let theme = theme(cx); @@ -477,7 +474,7 @@ impl ListDetailsEntry { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let settings = user_settings(cx); @@ -534,7 +531,7 @@ impl ListSeparator { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div().h_px().w_full().bg(theme.border) @@ -574,7 +571,7 @@ impl List { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let is_toggleable = self.toggleable != Toggleable::NotToggleable; let is_toggled = Toggleable::is_toggled(&self.toggleable); diff --git a/crates/ui2/src/components/modal.rs b/crates/ui2/src/components/modal.rs index 154df4e862e31095dd3f78f885ec6b285de2df1e..63e7bc7c1ad6c8face547ccf70b448081619b4e8 100644 --- a/crates/ui2/src/components/modal.rs +++ b/crates/ui2/src/components/modal.rs @@ -42,7 +42,7 @@ impl Modal { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() diff --git a/crates/ui2/src/components/multi_buffer.rs b/crates/ui2/src/components/multi_buffer.rs index 568302b55952cdf2a07c7d2e51541f5021c1b5f7..3bd3057d6593c5a8e0c9beb09c832bc5e6cc101a 100644 --- a/crates/ui2/src/components/multi_buffer.rs +++ b/crates/ui2/src/components/multi_buffer.rs @@ -17,7 +17,7 @@ impl MultiBuffer { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() @@ -62,11 +62,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); Story::container(cx) diff --git a/crates/ui2/src/components/notification_toast.rs b/crates/ui2/src/components/notification_toast.rs index afcef8fb203ebe6fc646c564cbde7e99de7038bb..cf68738a7ea3098a4dbbf41c1a2a251b8876ab4b 100644 --- a/crates/ui2/src/components/notification_toast.rs +++ b/crates/ui2/src/components/notification_toast.rs @@ -28,7 +28,7 @@ impl NotificationToast { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); h_stack() diff --git a/crates/ui2/src/components/notifications_panel.rs b/crates/ui2/src/components/notifications_panel.rs index fd0445d0070de313ebc464072ee22a5c68df2df6..1937c8e0609880b1bcf6f73c0ee24eaceea79baa 100644 --- a/crates/ui2/src/components/notifications_panel.rs +++ b/crates/ui2/src/components/notifications_panel.rs @@ -17,7 +17,7 @@ impl NotificationsPanel { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -70,11 +70,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, NotificationsPanel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/palette.rs b/crates/ui2/src/components/palette.rs index 9787086cd6dea3e6c0c7a6730315b7c7544c64cb..b7cb7033bc9403eb1ed1347f47792011a70870e2 100644 --- a/crates/ui2/src/components/palette.rs +++ b/crates/ui2/src/components/palette.rs @@ -46,7 +46,7 @@ impl Palette { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() @@ -135,7 +135,7 @@ impl PaletteItem { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .flex() .flex_row() @@ -172,11 +172,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Palette>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/panel.rs b/crates/ui2/src/components/panel.rs index 0c52a7a12adee6075f4452f780bccf9255ca6474..67b00d881bd57331d8543db4e32d5875c17c53d4 100644 --- a/crates/ui2/src/components/panel.rs +++ b/crates/ui2/src/components/panel.rs @@ -96,7 +96,7 @@ impl Panel { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let current_size = self.width.unwrap_or(self.initial_width); @@ -148,11 +148,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Panel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/panes.rs b/crates/ui2/src/components/panes.rs index 229de3caa434ede1fb227e09e0df9db88f7e0588..f100723f9153400b67fc6ed3eafcddb1f0ebcafd 100644 --- a/crates/ui2/src/components/panes.rs +++ b/crates/ui2/src/components/panes.rs @@ -101,7 +101,7 @@ impl PaneGroup { } } - fn render(&mut self, view: &mut V, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, view: &mut V, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); if !self.panes.is_empty() { diff --git a/crates/ui2/src/components/player_stack.rs b/crates/ui2/src/components/player_stack.rs index 0ada98aa3f5a32a4a25757d5c210d7a74fdd77b8..6ca16d14e621e3e4f01f5581e3f1578a14bf2f0c 100644 --- a/crates/ui2/src/components/player_stack.rs +++ b/crates/ui2/src/components/player_stack.rs @@ -17,7 +17,7 @@ impl PlayerStack { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let player = self.player_with_call_status.get_player(); self.player_with_call_status.get_call_status(); diff --git a/crates/ui2/src/components/project_panel.rs b/crates/ui2/src/components/project_panel.rs index 8b52a1b89aa71562584280cfe04beb1fdb23b43b..5a4591cadde5e1a8bbe0f8985fb8fc1a10c65d2e 100644 --- a/crates/ui2/src/components/project_panel.rs +++ b/crates/ui2/src/components/project_panel.rs @@ -19,7 +19,7 @@ impl ProjectPanel { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -79,11 +79,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, ProjectPanel>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/recent_projects.rs b/crates/ui2/src/components/recent_projects.rs index 16c019be533b0892d819b40dda9e9891e7ff07bb..bab96444a5679052095acd0d5b1ce9dc426e5ad3 100644 --- a/crates/ui2/src/components/recent_projects.rs +++ b/crates/ui2/src/components/recent_projects.rs @@ -17,7 +17,7 @@ impl RecentProjects { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div().id(self.id.clone()).child( Palette::new("palette") .items(vec![ @@ -56,11 +56,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, RecentProjects>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/status_bar.rs b/crates/ui2/src/components/status_bar.rs index 5eeeb841ef6377551baf3781331a7b01924f4d5b..786b3670a00cf23a2bc5468050eae65beea12ebb 100644 --- a/crates/ui2/src/components/status_bar.rs +++ b/crates/ui2/src/components/status_bar.rs @@ -86,7 +86,7 @@ impl StatusBar { &mut self, view: &mut Workspace, cx: &mut ViewContext, - ) -> impl Element { + ) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -101,7 +101,11 @@ impl StatusBar { .child(self.right_tools(view, cx)) } - fn left_tools(&self, workspace: &mut Workspace, cx: &WindowContext) -> impl Element { + fn left_tools( + &self, + workspace: &mut Workspace, + cx: &WindowContext, + ) -> impl IntoAnyElement { div() .flex() .items_center() @@ -132,7 +136,7 @@ impl StatusBar { &self, workspace: &mut Workspace, cx: &WindowContext, - ) -> impl Element { + ) -> impl IntoAnyElement { div() .flex() .items_center() diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs index 4bfd21248fce07bf353ddff903b8c38945a7f445..daff5ea66c6afd69a2bb99c8fa8e3c1777348f67 100644 --- a/crates/ui2/src/components/tab.rs +++ b/crates/ui2/src/components/tab.rs @@ -81,7 +81,7 @@ impl Tab { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict; let is_deleted = self.fs_status == FileSystemStatus::Deleted; @@ -188,11 +188,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let git_statuses = GitStatus::iter(); let fs_statuses = FileSystemStatus::iter(); diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rs index 0cc9409c048d8c8640f28c1ab24e3bde47a9a1df..4e49ef289aab289e32beb50da609ea79da2c8309 100644 --- a/crates/ui2/src/components/tab_bar.rs +++ b/crates/ui2/src/components/tab_bar.rs @@ -27,7 +27,7 @@ impl TabBar { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let (can_navigate_back, can_navigate_forward) = self.can_navigate; @@ -112,11 +112,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, TabBar>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/terminal.rs b/crates/ui2/src/components/terminal.rs index 480c1a5da6a8b48fa47729bd2ba395384c60b9e0..2061d42ad2c75e382675aac7ab6774ea79761698 100644 --- a/crates/ui2/src/components/terminal.rs +++ b/crates/ui2/src/components/terminal.rs @@ -17,7 +17,7 @@ impl Terminal { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let can_navigate_back = true; @@ -105,11 +105,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Terminal>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/theme_selector.rs b/crates/ui2/src/components/theme_selector.rs index cb1b491d87e2c173c04c2c2df3640cfe5bb0e50b..0758cf643b97f4387ec630527b2c681198fa7407 100644 --- a/crates/ui2/src/components/theme_selector.rs +++ b/crates/ui2/src/components/theme_selector.rs @@ -17,7 +17,7 @@ impl ThemeSelector { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div().child( Palette::new(self.id.clone()) .items(vec![ @@ -61,11 +61,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, ThemeSelector>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/title_bar.rs b/crates/ui2/src/components/title_bar.rs index 68661d0ea2080e1cf983f3da4d10d485f11c8116..a20c7877b2a91dc7f54d0c7d813bdad80e170f13 100644 --- a/crates/ui2/src/components/title_bar.rs +++ b/crates/ui2/src/components/title_bar.rs @@ -87,7 +87,7 @@ impl TitleBar { ) } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let settings = user_settings(cx); @@ -204,7 +204,7 @@ mod stories { ) } - fn render(&mut self, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, TitleBar>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/toast.rs b/crates/ui2/src/components/toast.rs index 9318b12eec2421e52a54130cd44ba1372d610a31..faf58467a26045f3dbfc0873286f439ba3a92b99 100644 --- a/crates/ui2/src/components/toast.rs +++ b/crates/ui2/src/components/toast.rs @@ -36,7 +36,7 @@ impl Toast { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let mut div = div(); @@ -90,7 +90,7 @@ mod stories { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Toast>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/toolbar.rs b/crates/ui2/src/components/toolbar.rs index 51ec6ee49761bc5445ad45f348b6992594122ed9..74b2c9257811d1a092bc769b4c6e50eee3f4e17d 100644 --- a/crates/ui2/src/components/toolbar.rs +++ b/crates/ui2/src/components/toolbar.rs @@ -54,7 +54,7 @@ impl Toolbar { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -92,11 +92,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); Story::container(cx) diff --git a/crates/ui2/src/components/traffic_lights.rs b/crates/ui2/src/components/traffic_lights.rs index e8750759428aff21f4ab472396e1a3b1dc1783c8..8ac76439f8240accb14f32f629fd5524dbbc05f7 100644 --- a/crates/ui2/src/components/traffic_lights.rs +++ b/crates/ui2/src/components/traffic_lights.rs @@ -25,7 +25,7 @@ impl TrafficLight { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let fill = match (self.window_has_focus, self.color) { @@ -58,7 +58,7 @@ impl TrafficLights { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .flex() .items_center() @@ -99,11 +99,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, TrafficLights>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rs index 92ea93ef026bd4d4e95f8f844c7b7b6268ccb034..34158c99185ebf6945577de39c58911dfc07f7b7 100644 --- a/crates/ui2/src/components/workspace.rs +++ b/crates/ui2/src/components/workspace.rs @@ -174,7 +174,7 @@ impl Workspace { view(cx.entity(|cx| Self::new(cx)), Self::render) } - pub fn render(&mut self, cx: &mut ViewContext) -> impl Element { + pub fn render(&mut self, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = old_theme(cx).clone(); // HACK: This should happen inside of `debug_toggle_user_settings`, but diff --git a/crates/ui2/src/elements/avatar.rs b/crates/ui2/src/elements/avatar.rs index 0bc1ccad2276934b66534982d50b7dae60d59c48..555818a87cf50e2039412056b256d8e3b0073760 100644 --- a/crates/ui2/src/elements/avatar.rs +++ b/crates/ui2/src/elements/avatar.rs @@ -25,7 +25,7 @@ impl Avatar { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let mut img = img(); @@ -63,11 +63,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Avatar>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs index 363f70ddb42e3865b1676da7f246199e3981c66a..9f399ea331e75a8d8ce6e8549571944aa4b8aae7 100644 --- a/crates/ui2/src/elements/button.rs +++ b/crates/ui2/src/elements/button.rs @@ -150,11 +150,7 @@ impl Button { self.icon.map(|i| IconElement::new(i).color(icon_color)) } - pub fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + pub fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let icon_color = self.icon_color(); let mut button = h_stack() @@ -211,7 +207,7 @@ impl ButtonGroup { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let mut el = h_stack().text_size(ui_size(cx, 1.)); for button in &mut self.buttons { @@ -246,11 +242,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let states = InteractionState::iter(); Story::container(cx) diff --git a/crates/ui2/src/elements/details.rs b/crates/ui2/src/elements/details.rs index e7df25f6a399586efe0be239593b7267dcd192ad..ea05436401a7feaa5b7c1b8db932edde422c58cb 100644 --- a/crates/ui2/src/elements/details.rs +++ b/crates/ui2/src/elements/details.rs @@ -30,7 +30,7 @@ impl Details { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); v_stack() @@ -66,11 +66,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Details>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/elements/icon.rs b/crates/ui2/src/elements/icon.rs index d20f262fbcb0711cf80415e2a1c4c6dbe9bbbc5c..2a0f6b3a0baa10bb6b571e989f01c98b9bd4e80c 100644 --- a/crates/ui2/src/elements/icon.rs +++ b/crates/ui2/src/elements/icon.rs @@ -176,7 +176,7 @@ impl IconElement { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let fill = self.color.color(cx); let svg_size = match self.size { IconSize::Small => ui_size(cx, 12. / 14.), @@ -214,11 +214,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let icons = Icon::iter(); Story::container(cx) diff --git a/crates/ui2/src/elements/input.rs b/crates/ui2/src/elements/input.rs index 56d81a0831f4a09916dac9cd23612362b28a2582..142acc887097e506d132c2c84366c10f299a8a23 100644 --- a/crates/ui2/src/elements/input.rs +++ b/crates/ui2/src/elements/input.rs @@ -60,7 +60,7 @@ impl Input { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let (input_bg, input_hover_bg, input_active_bg) = match self.variant { @@ -132,11 +132,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Input>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rs index d29ab8a5ee488551c88987fef0ef13a243da29c7..f8d4a8d1152d8ff22fd78689854a4a93e3165a4e 100644 --- a/crates/ui2/src/elements/label.rs +++ b/crates/ui2/src/elements/label.rs @@ -83,7 +83,7 @@ impl Label { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { div() .when(self.strikethrough, |this| { this.relative().child( @@ -135,7 +135,7 @@ impl HighlightedLabel { self } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); let highlight_color = theme.text_accent; @@ -223,11 +223,7 @@ mod stories { } } - fn render( - &mut self, - _view: &mut S, - cx: &mut ViewContext, - ) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { Story::container(cx) .child(Story::title_for::<_, Label>(cx)) .child(Story::label(cx, "Default")) diff --git a/crates/ui2/src/elements/tool_divider.rs b/crates/ui2/src/elements/tool_divider.rs index 46b790e6bb19fe6b9fe3317e01a48555926de244..f73c8953ee6c033cba1448f6d5c77171ea9354ea 100644 --- a/crates/ui2/src/elements/tool_divider.rs +++ b/crates/ui2/src/elements/tool_divider.rs @@ -14,7 +14,7 @@ impl ToolDivider { } } - fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl Element { + fn render(&mut self, _view: &mut S, cx: &mut ViewContext) -> impl IntoAnyElement { let theme = theme(cx); div().w_px().h_3().bg(theme.border) diff --git a/crates/ui2/src/story.rs b/crates/ui2/src/story.rs index 9fc6a11f197852b4cd6432e4bed8da849fc6e2ab..c4bf9c3caadac25c10d1b5f61a59b8316648a67b 100644 --- a/crates/ui2/src/story.rs +++ b/crates/ui2/src/story.rs @@ -21,7 +21,7 @@ impl Story { pub fn title( cx: &mut ViewContext, title: &str, - ) -> impl Element { + ) -> impl IntoAnyElement { let theme = theme(cx); div() @@ -32,14 +32,14 @@ impl Story { pub fn title_for( cx: &mut ViewContext, - ) -> impl Element { + ) -> impl IntoAnyElement { Self::title(cx, std::any::type_name::()) } pub fn label( cx: &mut ViewContext, label: &str, - ) -> impl Element { + ) -> impl IntoAnyElement { let theme = theme(cx); div()