diff --git a/crates/activity_indicator2/src/activity_indicator.rs b/crates/activity_indicator2/src/activity_indicator.rs index 1332aa8018..cbb6daca77 100644 --- a/crates/activity_indicator2/src/activity_indicator.rs +++ b/crates/activity_indicator2/src/activity_indicator.rs @@ -2,8 +2,8 @@ use auto_update::{AutoUpdateStatus, AutoUpdater, DismissErrorMessage}; use editor::Editor; use futures::StreamExt; use gpui::{ - actions, svg, AppContext, CursorStyle, Div, EventEmitter, InteractiveElement as _, Model, - ParentElement as _, Render, SharedString, Stateful, StatefulInteractiveElement, Styled, View, + actions, svg, AppContext, CursorStyle, EventEmitter, InteractiveElement as _, Model, + ParentElement as _, Render, SharedString, StatefulInteractiveElement, Styled, View, ViewContext, VisualContext as _, }; use language::{LanguageRegistry, LanguageServerBinaryStatus}; @@ -304,9 +304,7 @@ impl ActivityIndicator { impl EventEmitter for ActivityIndicator {} impl Render for ActivityIndicator { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let content = self.content_to_render(cx); let mut result = h_stack() diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index b04d99842c..5318096f57 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -30,9 +30,9 @@ use fs::Fs; use futures::StreamExt; use gpui::{ canvas, div, point, relative, rems, uniform_list, Action, AnyElement, AppContext, - AsyncWindowContext, AvailableSpace, ClipboardItem, Context, Div, EventEmitter, FocusHandle, - Focusable, FocusableView, FontStyle, FontWeight, HighlightStyle, InteractiveElement, - IntoElement, Model, ModelContext, ParentElement, Pixels, PromptLevel, Render, SharedString, + AsyncWindowContext, AvailableSpace, ClipboardItem, Context, EventEmitter, FocusHandle, + FocusableView, FontStyle, FontWeight, HighlightStyle, InteractiveElement, IntoElement, Model, + ModelContext, ParentElement, Pixels, PromptLevel, Render, SharedString, StatefulInteractiveElement, Styled, Subscription, Task, TextStyle, UniformListScrollHandle, View, ViewContext, VisualContext, WeakModel, WeakView, WhiteSpace, WindowContext, }; @@ -1101,9 +1101,7 @@ fn build_api_key_editor(cx: &mut ViewContext) -> View { } impl Render for AssistantPanel { - type Output = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { if let Some(api_key_editor) = self.api_key_editor.clone() { v_stack() .on_action(cx.listener(AssistantPanel::save_credentials)) @@ -2513,9 +2511,7 @@ impl ConversationEditor { impl EventEmitter for ConversationEditor {} impl Render for ConversationEditor { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { div() .key_context("ConversationEditor") .capture_action(cx.listener(ConversationEditor::cancel_last_assist)) @@ -2618,9 +2614,7 @@ struct InlineAssistant { impl EventEmitter for InlineAssistant {} impl Render for InlineAssistant { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let measurements = self.measurements.get(); h_stack() .w_full() diff --git a/crates/auto_update2/src/update_notification.rs b/crates/auto_update2/src/update_notification.rs index 7bbbcab0fe..009972b7ee 100644 --- a/crates/auto_update2/src/update_notification.rs +++ b/crates/auto_update2/src/update_notification.rs @@ -1,5 +1,5 @@ use gpui::{ - div, DismissEvent, Div, EventEmitter, InteractiveElement, ParentElement, Render, + div, DismissEvent, Element, EventEmitter, InteractiveElement, ParentElement, Render, SemanticVersion, StatefulInteractiveElement, Styled, ViewContext, }; use menu::Cancel; @@ -13,9 +13,7 @@ pub struct UpdateNotification { impl EventEmitter for UpdateNotification {} impl Render for UpdateNotification { - type Output = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { let app_name = cx.global::().display_name(); v_stack() diff --git a/crates/breadcrumbs2/src/breadcrumbs.rs b/crates/breadcrumbs2/src/breadcrumbs.rs index 77ee22493f..6750a95eb2 100644 --- a/crates/breadcrumbs2/src/breadcrumbs.rs +++ b/crates/breadcrumbs2/src/breadcrumbs.rs @@ -1,6 +1,6 @@ use editor::Editor; use gpui::{ - Div, Element, EventEmitter, IntoElement, ParentElement, Render, StyledText, Subscription, + Element, EventEmitter, IntoElement, ParentElement, Render, StyledText, Subscription, ViewContext, }; use itertools::Itertools; @@ -30,9 +30,7 @@ impl Breadcrumbs { impl EventEmitter for Breadcrumbs {} impl Render for Breadcrumbs { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let element = h_stack().text_ui(); let Some(active_item) = self.active_item.as_ref() else { return element; diff --git a/crates/collab_ui2/src/channel_view.rs b/crates/collab_ui2/src/channel_view.rs index 9ba8d506c9..04ca511905 100644 --- a/crates/collab_ui2/src/channel_view.rs +++ b/crates/collab_ui2/src/channel_view.rs @@ -222,10 +222,8 @@ impl ChannelView { impl EventEmitter for ChannelView {} impl Render for ChannelView { - type Output = AnyView; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { - self.editor.clone().into() + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { + self.editor.clone() } } diff --git a/crates/collab_ui2/src/chat_panel.rs b/crates/collab_ui2/src/chat_panel.rs index 17046587a1..07460e2620 100644 --- a/crates/collab_ui2/src/chat_panel.rs +++ b/crates/collab_ui2/src/chat_panel.rs @@ -8,8 +8,8 @@ use db::kvp::KEY_VALUE_STORE; use editor::Editor; use gpui::{ actions, div, list, prelude::*, px, serde_json, AnyElement, AppContext, AsyncWindowContext, - ClickEvent, Div, ElementId, EventEmitter, FocusableView, ListOffset, ListScrollEvent, - ListState, Model, Render, Subscription, Task, View, ViewContext, VisualContext, WeakView, + ClickEvent, ElementId, EventEmitter, FocusableView, ListOffset, ListScrollEvent, ListState, + Model, Render, Subscription, Task, View, ViewContext, VisualContext, WeakView, }; use language::LanguageRegistry; use menu::Confirm; @@ -549,9 +549,7 @@ impl ChatPanel { impl EventEmitter for ChatPanel {} impl Render for ChatPanel { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { div() .full() .child(if self.client.user_id().is_some() { diff --git a/crates/collab_ui2/src/chat_panel/message_editor.rs b/crates/collab_ui2/src/chat_panel/message_editor.rs index 908f57f2d6..d30a1009b6 100644 --- a/crates/collab_ui2/src/chat_panel/message_editor.rs +++ b/crates/collab_ui2/src/chat_panel/message_editor.rs @@ -3,7 +3,7 @@ use client::UserId; use collections::HashMap; use editor::{AnchorRangeExt, Editor}; use gpui::{ - AnyView, AsyncWindowContext, FocusableView, Model, Render, SharedString, Task, View, + AsyncWindowContext, Element, FocusableView, Model, Render, SharedString, Task, View, ViewContext, WeakView, }; use language::{language_settings::SoftWrap, Buffer, BufferSnapshot, LanguageRegistry}; @@ -196,9 +196,7 @@ impl MessageEditor { } impl Render for MessageEditor { - type Output = AnyView; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { self.editor.to_any() } } diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs index 24057f096d..1fb2f94f0a 100644 --- a/crates/collab_ui2/src/collab_panel.rs +++ b/crates/collab_ui2/src/collab_panel.rs @@ -17,9 +17,9 @@ use fuzzy::{match_strings, StringMatchCandidate}; use gpui::{ actions, canvas, div, fill, list, overlay, point, prelude::*, px, serde_json, AnyElement, AppContext, AsyncWindowContext, Bounds, ClipboardItem, DismissEvent, Div, EventEmitter, - FocusHandle, Focusable, FocusableView, InteractiveElement, IntoElement, ListOffset, ListState, - Model, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, RenderOnce, - SharedString, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, + FocusHandle, FocusableView, InteractiveElement, IntoElement, ListOffset, ListState, Model, + MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, RenderOnce, SharedString, + Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, }; use menu::{Cancel, Confirm, SelectNext, SelectPrev}; use project::{Fs, Project}; @@ -2263,9 +2263,7 @@ fn render_tree_branch(is_last: bool, cx: &mut WindowContext) -> impl IntoElement } impl Render for CollabPanel { - type Output = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { v_stack() .key_context("CollabPanel") .on_action(cx.listener(CollabPanel::cancel)) @@ -2453,9 +2451,7 @@ struct DraggedChannelView { } impl Render for DraggedChannelView { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone(); h_stack() .font(ui_font) diff --git a/crates/collab_ui2/src/collab_panel/channel_modal.rs b/crates/collab_ui2/src/collab_panel/channel_modal.rs index 47d142f01e..30fbe6cd55 100644 --- a/crates/collab_ui2/src/collab_panel/channel_modal.rs +++ b/crates/collab_ui2/src/collab_panel/channel_modal.rs @@ -5,9 +5,9 @@ use client::{ }; use fuzzy::{match_strings, StringMatchCandidate}; use gpui::{ - actions, div, overlay, AppContext, ClipboardItem, DismissEvent, Div, EventEmitter, - FocusableView, Model, ParentElement, Render, Styled, Subscription, Task, View, ViewContext, - VisualContext, WeakView, + actions, div, overlay, AppContext, ClipboardItem, DismissEvent, EventEmitter, FocusableView, + Model, ParentElement, Render, Styled, Subscription, Task, View, ViewContext, VisualContext, + WeakView, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; @@ -142,9 +142,7 @@ impl FocusableView for ChannelModal { } impl Render for ChannelModal { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let channel_store = self.channel_store.read(cx); let Some(channel) = channel_store.channel_for_id(self.channel_id) else { return div(); diff --git a/crates/collab_ui2/src/collab_panel/contact_finder.rs b/crates/collab_ui2/src/collab_panel/contact_finder.rs index 8368e176b3..da91feafe1 100644 --- a/crates/collab_ui2/src/collab_panel/contact_finder.rs +++ b/crates/collab_ui2/src/collab_panel/contact_finder.rs @@ -1,7 +1,7 @@ use client::{ContactRequestStatus, User, UserStore}; use gpui::{ - AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Model, - ParentElement as _, Render, Styled, Task, View, ViewContext, VisualContext, WeakView, + AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Model, ParentElement as _, + Render, Styled, Task, View, ViewContext, VisualContext, WeakView, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; @@ -35,7 +35,7 @@ impl ContactFinder { } impl Render for ContactFinder { - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { v_stack() .elevation_3(cx) .child( @@ -51,8 +51,6 @@ impl Render for ContactFinder { .child(self.picker.clone()) .w(rems(34.)) } - - type Output = Div; } pub struct ContactFinderDelegate { diff --git a/crates/collab_ui2/src/collab_titlebar_item.rs b/crates/collab_ui2/src/collab_titlebar_item.rs index 2ab2e3f3e2..4d2362c419 100644 --- a/crates/collab_ui2/src/collab_titlebar_item.rs +++ b/crates/collab_ui2/src/collab_titlebar_item.rs @@ -3,8 +3,8 @@ use auto_update::AutoUpdateStatus; use call::{ActiveCall, ParticipantLocation, Room}; use client::{proto::PeerId, Client, ParticipantIndex, User, UserStore}; use gpui::{ - actions, canvas, div, point, px, rems, Action, AnyElement, AppContext, Div, Element, Hsla, - InteractiveElement, IntoElement, Model, ParentElement, Path, Render, Stateful, + actions, canvas, div, point, px, rems, Action, AnyElement, AppContext, Element, Hsla, + InteractiveElement, IntoElement, Model, ParentElement, Path, Render, StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView, WindowBounds, }; @@ -56,9 +56,7 @@ pub struct CollabTitlebarItem { } impl Render for CollabTitlebarItem { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let room = ActiveCall::global(cx).read(cx).room().cloned(); let current_user = self.user_store.read(cx).current_user(); let client = self.client.clone(); diff --git a/crates/collab_ui2/src/notification_panel.rs b/crates/collab_ui2/src/notification_panel.rs index 11e88d8b59..f661318dc6 100644 --- a/crates/collab_ui2/src/notification_panel.rs +++ b/crates/collab_ui2/src/notification_panel.rs @@ -7,9 +7,9 @@ use db::kvp::KEY_VALUE_STORE; use futures::StreamExt; use gpui::{ actions, div, img, list, px, serde_json, AnyElement, AppContext, AsyncWindowContext, - CursorStyle, DismissEvent, Div, Element, EventEmitter, FocusHandle, FocusableView, + CursorStyle, DismissEvent, Element, EventEmitter, FocusHandle, FocusableView, InteractiveElement, IntoElement, ListAlignment, ListScrollEvent, ListState, Model, - ParentElement, Render, Stateful, StatefulInteractiveElement, Styled, Task, View, ViewContext, + ParentElement, Render, StatefulInteractiveElement, Styled, Task, View, ViewContext, VisualContext, WeakView, WindowContext, }; use notifications::{NotificationEntry, NotificationEvent, NotificationStore}; @@ -540,9 +540,7 @@ impl NotificationPanel { } impl Render for NotificationPanel { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Div { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { v_stack() .size_full() .child( @@ -706,9 +704,7 @@ impl NotificationToast { } impl Render for NotificationToast { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let user = self.actor.clone(); h_stack() diff --git a/crates/collab_ui2/src/notifications/incoming_call_notification.rs b/crates/collab_ui2/src/notifications/incoming_call_notification.rs index dea6fc9359..b7c7309414 100644 --- a/crates/collab_ui2/src/notifications/incoming_call_notification.rs +++ b/crates/collab_ui2/src/notifications/incoming_call_notification.rs @@ -2,7 +2,7 @@ use crate::notification_window_options; use call::{ActiveCall, IncomingCall}; use futures::StreamExt; use gpui::{ - img, px, AppContext, Div, ParentElement, Render, RenderOnce, Styled, ViewContext, + img, px, AppContext, ParentElement, Render, RenderOnce, Styled, ViewContext, VisualContext as _, WindowHandle, }; use settings::Settings; @@ -117,9 +117,7 @@ impl IncomingCallNotification { } impl Render for IncomingCallNotification { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { // TODO: Is there a better place for us to initialize the font? let (ui_font, ui_font_size) = { let theme_settings = ThemeSettings::get_global(cx); diff --git a/crates/collab_ui2/src/notifications/project_shared_notification.rs b/crates/collab_ui2/src/notifications/project_shared_notification.rs index fc7cc2b2d0..baeade6ee5 100644 --- a/crates/collab_ui2/src/notifications/project_shared_notification.rs +++ b/crates/collab_ui2/src/notifications/project_shared_notification.rs @@ -2,9 +2,7 @@ use crate::notification_window_options; use call::{room, ActiveCall}; use client::User; use collections::HashMap; -use gpui::{ - img, px, AppContext, Div, ParentElement, Render, Size, Styled, ViewContext, VisualContext, -}; +use gpui::{img, px, AppContext, ParentElement, Render, Size, Styled, ViewContext, VisualContext}; use settings::Settings; use std::sync::{Arc, Weak}; use theme::ThemeSettings; @@ -120,9 +118,7 @@ impl ProjectSharedNotification { } impl Render for ProjectSharedNotification { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { // TODO: Is there a better place for us to initialize the font? let (ui_font, ui_font_size) = { let theme_settings = ThemeSettings::get_global(cx); diff --git a/crates/command_palette2/src/command_palette.rs b/crates/command_palette2/src/command_palette.rs index ae23c0b966..1a16af2b11 100644 --- a/crates/command_palette2/src/command_palette.rs +++ b/crates/command_palette2/src/command_palette.rs @@ -6,7 +6,7 @@ use std::{ use collections::{CommandPaletteFilter, HashMap}; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - actions, Action, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, + actions, Action, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView, }; use picker::{Picker, PickerDelegate}; @@ -83,9 +83,7 @@ impl FocusableView for CommandPalette { } impl Render for CommandPalette { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { v_stack().w(rems(34.)).child(self.picker.clone()) } } diff --git a/crates/copilot2/src/sign_in.rs b/crates/copilot2/src/sign_in.rs index 22e10fbdc3..cee049a706 100644 --- a/crates/copilot2/src/sign_in.rs +++ b/crates/copilot2/src/sign_in.rs @@ -1,8 +1,8 @@ use crate::{request::PromptUserDeviceFlow, Copilot, Status}; use gpui::{ - div, size, AppContext, Bounds, ClipboardItem, Div, Element, GlobalPixels, InteractiveElement, - IntoElement, ParentElement, Point, Render, Stateful, Styled, ViewContext, VisualContext, - WindowBounds, WindowHandle, WindowKind, WindowOptions, + div, size, AppContext, Bounds, ClipboardItem, Element, GlobalPixels, InteractiveElement, + IntoElement, ParentElement, Point, Render, Styled, ViewContext, VisualContext, WindowBounds, + WindowHandle, WindowKind, WindowOptions, }; use theme::ActiveTheme; use ui::{prelude::*, Button, Icon, IconElement, Label}; @@ -181,9 +181,7 @@ impl CopilotCodeVerification { } impl Render for CopilotCodeVerification { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let prompt = match &self.status { Status::SigningIn { prompt: Some(prompt), diff --git a/crates/copilot_button2/src/copilot_button.rs b/crates/copilot_button2/src/copilot_button.rs index 0c62a3c489..06cacb0b07 100644 --- a/crates/copilot_button2/src/copilot_button.rs +++ b/crates/copilot_button2/src/copilot_button.rs @@ -3,8 +3,8 @@ use copilot::{Copilot, SignOut, Status}; use editor::{scroll::autoscroll::Autoscroll, Editor}; use fs::Fs; use gpui::{ - div, Action, AnchorCorner, AppContext, AsyncWindowContext, Div, Entity, ParentElement, Render, - Subscription, View, ViewContext, WeakView, WindowContext, + div, Action, AnchorCorner, AppContext, AsyncWindowContext, Element, Entity, ParentElement, + Render, Subscription, View, ViewContext, WeakView, WindowContext, }; use language::{ language_settings::{self, all_language_settings, AllLanguageSettings}, @@ -34,9 +34,7 @@ pub struct CopilotButton { } impl Render for CopilotButton { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let all_language_settings = all_language_settings(None, cx); if !all_language_settings.copilot.feature_enabled { return div(); diff --git a/crates/diagnostics2/src/diagnostics.rs b/crates/diagnostics2/src/diagnostics.rs index dfecdfed51..c7ed7f84fb 100644 --- a/crates/diagnostics2/src/diagnostics.rs +++ b/crates/diagnostics2/src/diagnostics.rs @@ -13,10 +13,10 @@ use editor::{ }; use futures::future::try_join_all; use gpui::{ - actions, div, AnyElement, AnyView, AppContext, Context, Div, EventEmitter, FocusHandle, - Focusable, FocusableView, HighlightStyle, InteractiveElement, IntoElement, Model, - ParentElement, Render, SharedString, Styled, StyledText, Subscription, Task, View, ViewContext, - VisualContext, WeakView, WindowContext, + actions, div, AnyElement, AnyView, AppContext, Context, EventEmitter, FocusHandle, + FocusableView, HighlightStyle, InteractiveElement, IntoElement, Model, ParentElement, Render, + SharedString, Styled, StyledText, Subscription, Task, View, ViewContext, VisualContext, + WeakView, WindowContext, }; use language::{ Anchor, Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, @@ -91,9 +91,7 @@ struct DiagnosticGroupState { impl EventEmitter for ProjectDiagnosticsEditor {} impl Render for ProjectDiagnosticsEditor { - type Output = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let child = if self.path_states.is_empty() { div() .bg(cx.theme().colors().editor_background) diff --git a/crates/diagnostics2/src/items.rs b/crates/diagnostics2/src/items.rs index 5901b6803d..959cf14fdb 100644 --- a/crates/diagnostics2/src/items.rs +++ b/crates/diagnostics2/src/items.rs @@ -1,7 +1,7 @@ use collections::HashSet; use editor::Editor; use gpui::{ - rems, Div, EventEmitter, IntoElement, ParentElement, Render, Styled, Subscription, View, + rems, EventEmitter, IntoElement, ParentElement, Render, Styled, Subscription, View, ViewContext, WeakView, }; use language::Diagnostic; @@ -21,9 +21,7 @@ pub struct DiagnosticIndicator { } impl Render for DiagnosticIndicator { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let diagnostic_indicator = match (self.summary.error_count, self.summary.warning_count) { (0, 0) => h_stack().child( IconElement::new(Icon::Check) diff --git a/crates/diagnostics2/src/toolbar_controls.rs b/crates/diagnostics2/src/toolbar_controls.rs index 1446029194..0dc17f9320 100644 --- a/crates/diagnostics2/src/toolbar_controls.rs +++ b/crates/diagnostics2/src/toolbar_controls.rs @@ -1,5 +1,5 @@ use crate::ProjectDiagnosticsEditor; -use gpui::{div, Div, EventEmitter, ParentElement, Render, ViewContext, WeakView}; +use gpui::{div, EventEmitter, ParentElement, Render, ViewContext, WeakView}; use ui::prelude::*; use ui::{Icon, IconButton, Tooltip}; use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; @@ -9,9 +9,7 @@ pub struct ToolbarControls { } impl Render for ToolbarControls { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let include_warnings = self .editor .as_ref() diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 817744a47f..7ddcbce273 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -9291,9 +9291,7 @@ impl FocusableView for Editor { } impl Render for Editor { - type Output = EditorElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render<'a>(&mut self, cx: &mut ViewContext<'a, Self>) -> impl 'static + Element { let settings = ThemeSettings::get_global(cx); let text_style = match self.mode { EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle { diff --git a/crates/editor2/src/items.rs b/crates/editor2/src/items.rs index 349b3140fe..f1969ff93c 100644 --- a/crates/editor2/src/items.rs +++ b/crates/editor2/src/items.rs @@ -7,7 +7,7 @@ use anyhow::{anyhow, Context as _, Result}; use collections::HashSet; use futures::future::try_join_all; use gpui::{ - div, point, AnyElement, AppContext, AsyncWindowContext, Context, Div, Entity, EntityId, + div, point, AnyElement, AppContext, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, IntoElement, Model, ParentElement, Pixels, Render, SharedString, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext, }; @@ -1193,9 +1193,7 @@ impl CursorPosition { } impl Render for CursorPosition { - type Output = Div; - - fn render(&mut self, _: &mut ViewContext) -> Self::Output { + fn render(&mut self, _: &mut ViewContext) -> impl Element { div().when_some(self.position, |el, position| { let mut text = format!( "{}{FILE_ROW_COLUMN_DELIMITER}{}", diff --git a/crates/feedback2/src/deploy_feedback_button.rs b/crates/feedback2/src/deploy_feedback_button.rs index 9a112c25db..0e0dae30ff 100644 --- a/crates/feedback2/src/deploy_feedback_button.rs +++ b/crates/feedback2/src/deploy_feedback_button.rs @@ -1,4 +1,4 @@ -use gpui::{AnyElement, Render, ViewContext, WeakView}; +use gpui::{Render, ViewContext, WeakView}; use ui::{prelude::*, ButtonCommon, Icon, IconButton, Tooltip}; use workspace::{item::ItemHandle, StatusItemView, Workspace}; @@ -17,9 +17,7 @@ impl DeployFeedbackButton { } impl Render for DeployFeedbackButton { - type Output = AnyElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let is_open = self .workspace .upgrade() diff --git a/crates/feedback2/src/feedback_modal.rs b/crates/feedback2/src/feedback_modal.rs index 94e051f247..1f701df8ed 100644 --- a/crates/feedback2/src/feedback_modal.rs +++ b/crates/feedback2/src/feedback_modal.rs @@ -7,8 +7,8 @@ use db::kvp::KEY_VALUE_STORE; use editor::{Editor, EditorEvent}; use futures::AsyncReadExt; use gpui::{ - div, red, rems, serde_json, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, - FocusableView, Model, PromptLevel, Render, Task, View, ViewContext, + div, red, rems, serde_json, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, + Model, PromptLevel, Render, Task, View, ViewContext, }; use isahc::Request; use language::Buffer; @@ -396,9 +396,7 @@ impl FeedbackModal { } impl Render for FeedbackModal { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { self.update_submission_state(cx); let submit_button_text = if self.awaiting_submission() { diff --git a/crates/file_finder2/src/file_finder.rs b/crates/file_finder2/src/file_finder.rs index 4676d91f72..8999a41dde 100644 --- a/crates/file_finder2/src/file_finder.rs +++ b/crates/file_finder2/src/file_finder.rs @@ -2,7 +2,7 @@ use collections::HashMap; use editor::{scroll::autoscroll::Autoscroll, Bias, Editor}; use fuzzy::{CharBag, PathMatch, PathMatchCandidate}; use gpui::{ - actions, rems, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Model, + actions, rems, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Model, ParentElement, Render, Styled, Task, View, ViewContext, VisualContext, WeakView, }; use picker::{Picker, PickerDelegate}; @@ -118,9 +118,7 @@ impl FocusableView for FileFinder { } } impl Render for FileFinder { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { v_stack().w(rems(34.)).child(self.picker.clone()) } } diff --git a/crates/go_to_line2/src/go_to_line.rs b/crates/go_to_line2/src/go_to_line.rs index 97118dad66..66a454f5f2 100644 --- a/crates/go_to_line2/src/go_to_line.rs +++ b/crates/go_to_line2/src/go_to_line.rs @@ -1,8 +1,7 @@ use editor::{display_map::ToDisplayPoint, scroll::autoscroll::Autoscroll, Editor}; use gpui::{ - actions, div, prelude::*, AnyWindowHandle, AppContext, DismissEvent, Div, EventEmitter, - FocusHandle, FocusableView, Render, SharedString, Styled, Subscription, View, ViewContext, - VisualContext, + actions, div, prelude::*, AnyWindowHandle, AppContext, DismissEvent, EventEmitter, FocusHandle, + FocusableView, Render, SharedString, Styled, Subscription, View, ViewContext, VisualContext, }; use text::{Bias, Point}; use theme::ActiveTheme; @@ -153,9 +152,7 @@ impl GoToLine { } impl Render for GoToLine { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { div() .elevation_2(cx) .key_context("GoToLine") diff --git a/crates/gpui2/src/app/test_context.rs b/crates/gpui2/src/app/test_context.rs index 3aa09d2189..55d493b87c 100644 --- a/crates/gpui2/src/app/test_context.rs +++ b/crates/gpui2/src/app/test_context.rs @@ -1,6 +1,6 @@ use crate::{ div, Action, AnyView, AnyWindowHandle, AppCell, AppContext, AsyncAppContext, - BackgroundExecutor, Bounds, ClipboardItem, Context, Div, Entity, EventEmitter, + BackgroundExecutor, Bounds, ClipboardItem, Context, Element, Entity, EventEmitter, ForegroundExecutor, InputEvent, KeyDownEvent, Keystroke, Model, ModelContext, Pixels, Platform, PlatformWindow, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform, TestWindow, TestWindowHandlers, TextSystem, View, ViewContext, VisualContext, WindowBounds, WindowContext, @@ -733,9 +733,7 @@ impl AnyWindowHandle { pub struct EmptyView {} impl Render for EmptyView { - type Output = Div; - - fn render(&mut self, _cx: &mut crate::ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut crate::ViewContext) -> impl Element { div() } } diff --git a/crates/gpui2/src/element.rs b/crates/gpui2/src/element.rs index 08b6ec0408..0282606558 100644 --- a/crates/gpui2/src/element.rs +++ b/crates/gpui2/src/element.rs @@ -6,36 +6,17 @@ use derive_more::{Deref, DerefMut}; pub(crate) use smallvec::SmallVec; use std::{any::Any, fmt::Debug}; -/// Elements describe the contents of a window for a given frame. -/// Like HTML elements, elements form a tree and participate in layout. -/// In GPUI, elements are single-use objects that do not outlive a single frame. -/// Elements are associated with state. -/// If the element has an identifier, the element's state persists across frames in which the element appears. -/// If the element is anonymous, the state only persists across from layout request to paint in is referred to as "frame state". -/// A potential improvement would be to separate this temporary frame state from persistent element state at the type level, and request element state from the context with an id. /cc @as-cii\ -/// To render the contents of a window, we first walk over the tree of elements recursively via [request_layout], giving each an opportunity to register with the layout engine. -/// Then we compute the requested layout and use the computed bounds to paint the element tree recursively with [paint]. -/// You can implement this trait yourself for performance or other special situations, but you'll typically compose existing elements such as `Div`, `Img`, etc. pub trait Element: 'static + IntoElement { - /// State that is carried from [request_layout] to [paint] for anonymous elements, and between frames for elements that have an id. type State: 'static; - /// Recursively register this element and all its descendants with the layout engine. - /// If this element has an id, you'll receive the [State] from the previous frame if an element with this id existed in that frame. - /// Return the [LayoutId] you requested from the engine and whatever state you want to carry over to [paint], and also the next frame if this element has an id. - fn request_layout( + fn layout( &mut self, state: Option, cx: &mut WindowContext, ) -> (LayoutId, Self::State); - /// Recursively paint this element by populating the current frame's [Scene] with geometric primitives such as quads, sprites, paths, etc. - /// Receives the state from layout, and potentially the previous frame if this element has an id. fn paint(&mut self, bounds: Bounds, state: &mut Self::State, cx: &mut WindowContext); - /// Convert into a dynamically-typed [AnyElement]. - /// Before an element can be painted, it must be converted into an [AnyElement]. - /// It's also useful in situations where you need to own an element, but don't care about its specific type. fn into_any(self) -> AnyElement { AnyElement::new(self) } @@ -125,14 +106,8 @@ pub trait IntoElement: Sized { } } -/// A trait that all [View] types must implement. -/// This trait tells the framework how a particular type is displayed on screen. -/// For any type `V` implementing `Render`, you can create a `View` handle, which can be used as an element in another view or as the root of a window. pub trait Render: 'static + Sized { - type Output: IntoElement; - - /// Describes how this type is displayed on screen. - fn render(&mut self, cx: &mut ViewContext) -> Self::Output; + fn render(&mut self, cx: &mut ViewContext) -> impl Element; } /// You can derive [IntoElement] on any type that implements this trait. @@ -192,7 +167,7 @@ impl Element for Component { let mut element = self.component.take().unwrap().render(cx).into_element(); if let Some(element_id) = element.element_id() { let layout_id = - cx.with_element_state(element_id, |state, cx| element.request_layout(state, cx)); + cx.with_element_state(element_id, |state, cx| element.layout(state, cx)); let state = ComponentState { rendered_element: Some(element), rendered_element_state: None, @@ -200,7 +175,7 @@ impl Element for Component { (layout_id, state) } else { let (layout_id, state) = - element.request_layout(state.and_then(|s| s.rendered_element_state), cx); + element.layout(state.and_then(|s| s.rendered_element_state), cx); let state = ComponentState { rendered_element: Some(element), rendered_element_state: Some(state), diff --git a/crates/gpui2/src/interactive.rs b/crates/gpui2/src/interactive.rs index 7a4c3d013f..4f4c163077 100644 --- a/crates/gpui2/src/interactive.rs +++ b/crates/gpui2/src/interactive.rs @@ -1,5 +1,5 @@ use crate::{ - div, point, Div, Element, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, ViewContext, + div, point, Element, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, ViewContext, }; use smallvec::SmallVec; use std::{any::Any, fmt::Debug, marker::PhantomData, ops::Deref, path::PathBuf}; @@ -205,9 +205,7 @@ impl ExternalPaths { } impl Render for ExternalPaths { - type Output = Div; - - fn render(&mut self, _: &mut ViewContext) -> Self::Output { + fn render(&mut self, _: &mut ViewContext) -> impl Element { div() // Intentionally left empty because the platform will render icons for the dragged files } } @@ -292,8 +290,8 @@ impl InputEvent { #[cfg(test)] mod test { use crate::{ - self as gpui, div, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, - Keystroke, ParentElement, Render, Stateful, TestAppContext, VisualContext, + self as gpui, div, Element, FocusHandle, InteractiveElement, IntoElement, KeyBinding, + Keystroke, ParentElement, Render, TestAppContext, VisualContext, }; struct TestView { @@ -305,9 +303,7 @@ mod test { actions!(test, [TestAction]); impl Render for TestView { - type Output = Stateful
; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { div().id("testview").child( div() .key_context("parent") diff --git a/crates/gpui2/src/view.rs b/crates/gpui2/src/view.rs index afa08f9213..b39445d541 100644 --- a/crates/gpui2/src/view.rs +++ b/crates/gpui2/src/view.rs @@ -312,18 +312,6 @@ impl std::fmt::Debug for AnyWeakView { } } -impl Render for T -where - T: 'static + FnMut(&mut WindowContext) -> E, - E: 'static + Send + Element, -{ - type Output = E; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { - (self)(cx) - } -} - mod any_view { use crate::{AnyElement, AnyView, IntoElement, LayoutId, Render, WindowContext}; diff --git a/crates/gpui2_macros/src/derive_render.rs b/crates/gpui2_macros/src/derive_render.rs index 2695d4a7c5..e5c147575d 100644 --- a/crates/gpui2_macros/src/derive_render.rs +++ b/crates/gpui2_macros/src/derive_render.rs @@ -11,9 +11,7 @@ pub fn derive_render(input: TokenStream) -> TokenStream { impl #impl_generics gpui::Render for #type_name #type_generics #where_clause { - type Output = (); - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { () } } diff --git a/crates/language_selector2/src/active_buffer_language.rs b/crates/language_selector2/src/active_buffer_language.rs index 21f7bf233d..434a6c4420 100644 --- a/crates/language_selector2/src/active_buffer_language.rs +++ b/crates/language_selector2/src/active_buffer_language.rs @@ -1,6 +1,6 @@ use editor::Editor; use gpui::{ - div, Div, IntoElement, ParentElement, Render, Subscription, View, ViewContext, WeakView, + div, Element, IntoElement, ParentElement, Render, Subscription, View, ViewContext, WeakView, }; use std::sync::Arc; use ui::{Button, ButtonCommon, Clickable, LabelSize, Tooltip}; @@ -38,9 +38,7 @@ impl ActiveBufferLanguage { } impl Render for ActiveBufferLanguage { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Div { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { div().when_some(self.active_language.as_ref(), |el, active_language| { let active_language_text = if let Some(active_language_text) = active_language { active_language_text.to_string() diff --git a/crates/language_selector2/src/language_selector.rs b/crates/language_selector2/src/language_selector.rs index 16c661b6fb..7c0e5f9467 100644 --- a/crates/language_selector2/src/language_selector.rs +++ b/crates/language_selector2/src/language_selector.rs @@ -5,7 +5,7 @@ use anyhow::anyhow; use editor::Editor; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ - actions, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Model, + actions, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Model, ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView, }; use language::{Buffer, LanguageRegistry}; @@ -67,9 +67,7 @@ impl LanguageSelector { } impl Render for LanguageSelector { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { v_stack().w(rems(34.)).child(self.picker.clone()) } } diff --git a/crates/language_tools2/src/lsp_log.rs b/crates/language_tools2/src/lsp_log.rs index 00f1e86e5f..1be0d2780a 100644 --- a/crates/language_tools2/src/lsp_log.rs +++ b/crates/language_tools2/src/lsp_log.rs @@ -1,10 +1,10 @@ use collections::{HashMap, VecDeque}; -use editor::{Editor, EditorElement, EditorEvent, MoveToEnd}; +use editor::{Editor, EditorEvent, MoveToEnd}; use futures::{channel::mpsc, StreamExt}; use gpui::{ - actions, div, AnchorCorner, AnyElement, AppContext, Context, Div, EventEmitter, FocusHandle, - FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled, Subscription, - View, ViewContext, VisualContext, WeakModel, WindowContext, + actions, div, AnchorCorner, AnyElement, AppContext, Context, Element, EventEmitter, + FocusHandle, FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled, + Subscription, View, ViewContext, VisualContext, WeakModel, WindowContext, }; use language::{LanguageServerId, LanguageServerName}; use lsp::IoKind; @@ -595,10 +595,9 @@ fn log_contents(lines: &VecDeque) -> String { } impl Render for LspLogView { - type Output = EditorElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { - self.editor.update(cx, |editor, cx| editor.render(cx)) + fn render(&mut self, cx: &mut ViewContext) -> impl Element { + self.editor + .update(cx, |editor, cx| editor.render(cx).into_any()) } } @@ -709,9 +708,7 @@ impl ToolbarItemView for LspLogToolbarItemView { } impl Render for LspLogToolbarItemView { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let Some(log_view) = self.log_view.clone() else { return div(); }; diff --git a/crates/language_tools2/src/syntax_tree_view.rs b/crates/language_tools2/src/syntax_tree_view.rs index 1794b45337..3b14b77582 100644 --- a/crates/language_tools2/src/syntax_tree_view.rs +++ b/crates/language_tools2/src/syntax_tree_view.rs @@ -1,6 +1,6 @@ use editor::{scroll::autoscroll::Autoscroll, Anchor, Editor, ExcerptId}; use gpui::{ - actions, canvas, div, rems, uniform_list, AnyElement, AppContext, AvailableSpace, Div, + actions, canvas, div, rems, uniform_list, AnyElement, AppContext, AvailableSpace, Div, Element, EventEmitter, FocusHandle, FocusableView, Hsla, InteractiveElement, IntoElement, Model, MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, Pixels, Render, Styled, UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WindowContext, @@ -305,9 +305,7 @@ impl SyntaxTreeView { } impl Render for SyntaxTreeView { - type Output = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl Element { let settings = ThemeSettings::get_global(cx); let line_height = cx .text_style() @@ -507,9 +505,7 @@ fn format_node_range(node: Node) -> String { } impl Render for SyntaxTreeToolbarItemView { - type Output = PopoverMenu; - - fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> PopoverMenu { + fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl Element { self.render_menu(cx) .unwrap_or_else(|| popover_menu("Empty Syntax Tree")) } diff --git a/crates/outline2/src/outline.rs b/crates/outline2/src/outline.rs index 2f29534b6e..e9af96c1e5 100644 --- a/crates/outline2/src/outline.rs +++ b/crates/outline2/src/outline.rs @@ -4,7 +4,7 @@ use editor::{ }; use fuzzy::StringMatch; use gpui::{ - actions, div, rems, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, + actions, div, rems, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, FontStyle, FontWeight, HighlightStyle, ParentElement, Point, Render, Styled, StyledText, Task, TextStyle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext, }; @@ -57,9 +57,7 @@ impl EventEmitter for OutlineView {} impl ModalView for OutlineView {} impl Render for OutlineView { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { v_stack().w(rems(34.)).child(self.picker.clone()) } } diff --git a/crates/picker2/src/picker2.rs b/crates/picker2/src/picker2.rs index 6632c13ddf..e95c9af003 100644 --- a/crates/picker2/src/picker2.rs +++ b/crates/picker2/src/picker2.rs @@ -1,8 +1,8 @@ use editor::Editor; use gpui::{ - div, prelude::*, uniform_list, AnyElement, AppContext, DismissEvent, Div, EventEmitter, - FocusHandle, FocusableView, Length, MouseButton, MouseDownEvent, Render, Task, - UniformListScrollHandle, View, ViewContext, WindowContext, + div, prelude::*, uniform_list, AnyElement, AppContext, DismissEvent, EventEmitter, FocusHandle, + FocusableView, Length, MouseButton, MouseDownEvent, Render, Task, UniformListScrollHandle, + View, ViewContext, WindowContext, }; use std::{cmp, sync::Arc}; use ui::{prelude::*, v_stack, Color, Divider, Label, ListItem, ListItemSpacing, ListSeparator}; @@ -228,9 +228,7 @@ impl EventEmitter for Picker {} impl ModalView for Picker {} impl Render for Picker { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let picker_editor = h_stack() .overflow_hidden() .flex_none() diff --git a/crates/project_panel2/src/project_panel.rs b/crates/project_panel2/src/project_panel.rs index c0dfe995f6..6a2e98ce5e 100644 --- a/crates/project_panel2/src/project_panel.rs +++ b/crates/project_panel2/src/project_panel.rs @@ -9,10 +9,10 @@ use file_associations::FileAssociations; use anyhow::{anyhow, Result}; use gpui::{ actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext, - ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, Focusable, FocusableView, - InteractiveElement, KeyContext, Model, MouseButton, MouseDownEvent, ParentElement, Pixels, - Point, PromptLevel, Render, Stateful, Styled, Subscription, Task, UniformListScrollHandle, - View, ViewContext, VisualContext as _, WeakView, WindowContext, + ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement, + KeyContext, Model, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, + Render, Stateful, Styled, Subscription, Task, UniformListScrollHandle, View, ViewContext, + VisualContext as _, WeakView, WindowContext, }; use menu::{Confirm, SelectNext, SelectPrev}; use project::{ @@ -1480,9 +1480,7 @@ impl ProjectPanel { } impl Render for ProjectPanel { - type Output = Focusable>; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { let has_worktree = self.visible_entries.len() != 0; if has_worktree { @@ -1548,9 +1546,7 @@ impl Render for ProjectPanel { } impl Render for DraggedProjectEntryView { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let settings = ProjectPanelSettings::get_global(cx); let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone(); h_stack() diff --git a/crates/quick_action_bar2/src/quick_action_bar.rs b/crates/quick_action_bar2/src/quick_action_bar.rs index 686804e9d9..44ca0150e8 100644 --- a/crates/quick_action_bar2/src/quick_action_bar.rs +++ b/crates/quick_action_bar2/src/quick_action_bar.rs @@ -2,8 +2,8 @@ use assistant::{AssistantPanel, InlineAssist}; use editor::Editor; use gpui::{ - Action, ClickEvent, Div, ElementId, EventEmitter, InteractiveElement, ParentElement, Render, - Stateful, Styled, Subscription, View, ViewContext, WeakView, + Action, ClickEvent, ElementId, EventEmitter, InteractiveElement, ParentElement, Render, Styled, + Subscription, View, ViewContext, WeakView, }; use search::{buffer_search, BufferSearchBar}; use ui::{prelude::*, ButtonSize, ButtonStyle, Icon, IconButton, IconSize, Tooltip}; @@ -36,9 +36,7 @@ impl QuickActionBar { } impl Render for QuickActionBar { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let Some(editor) = self.active_editor() else { return div().id("empty quick action bar"); }; diff --git a/crates/recent_projects2/src/recent_projects.rs b/crates/recent_projects2/src/recent_projects.rs index 6b62d185ed..5178c1d9d8 100644 --- a/crates/recent_projects2/src/recent_projects.rs +++ b/crates/recent_projects2/src/recent_projects.rs @@ -3,8 +3,8 @@ mod projects; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Result, Subscription, - Task, View, ViewContext, WeakView, + AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Result, Subscription, Task, + View, ViewContext, WeakView, }; use highlighted_workspace_location::HighlightedWorkspaceLocation; use ordered_float::OrderedFloat; @@ -103,9 +103,7 @@ impl FocusableView for RecentProjects { } impl Render for RecentProjects { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { v_stack() .w(rems(self.rem_width)) .child(self.picker.clone()) diff --git a/crates/search2/src/buffer_search.rs b/crates/search2/src/buffer_search.rs index a5522cec89..02e664a109 100644 --- a/crates/search2/src/buffer_search.rs +++ b/crates/search2/src/buffer_search.rs @@ -10,7 +10,7 @@ use collections::HashMap; use editor::{Editor, EditorElement, EditorStyle}; use futures::channel::oneshot; use gpui::{ - actions, div, impl_actions, Action, AppContext, ClickEvent, Div, EventEmitter, FocusableView, + actions, div, impl_actions, Action, AppContext, ClickEvent, EventEmitter, FocusableView, FontStyle, FontWeight, InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, Render, Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext as _, WhiteSpace, WindowContext, @@ -101,9 +101,7 @@ impl BufferSearchBar { impl EventEmitter for BufferSearchBar {} impl EventEmitter for BufferSearchBar {} impl Render for BufferSearchBar { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { if self.dismissed { return div(); } diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rs index 167299ba2d..efb60c414c 100644 --- a/crates/search2/src/project_search.rs +++ b/crates/search2/src/project_search.rs @@ -12,11 +12,11 @@ use editor::{ }; use editor::{EditorElement, EditorStyle}; use gpui::{ - actions, div, AnyElement, AnyView, AppContext, Context as _, Div, Element, EntityId, - EventEmitter, FocusHandle, FocusableView, FontStyle, FontWeight, InteractiveElement, - IntoElement, KeyContext, Model, ModelContext, ParentElement, PromptLevel, Render, SharedString, - Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext, WeakModel, WeakView, - WhiteSpace, WindowContext, + actions, div, AnyElement, AnyView, AppContext, Context as _, Element, EntityId, EventEmitter, + FocusHandle, FocusableView, FontStyle, FontWeight, InteractiveElement, IntoElement, KeyContext, + Model, ModelContext, ParentElement, PromptLevel, Render, SharedString, Styled, Subscription, + Task, TextStyle, View, ViewContext, VisualContext, WeakModel, WeakView, WhiteSpace, + WindowContext, }; use menu::Confirm; use project::{ @@ -279,9 +279,7 @@ pub enum ViewEvent { impl EventEmitter for ProjectSearchView {} impl Render for ProjectSearchView { - type Output = AnyElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { if self.has_matches() { div() .flex_1() @@ -1494,9 +1492,7 @@ impl ProjectSearchBar { } impl Render for ProjectSearchBar { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let Some(search) = self.active_project_search.clone() else { return div(); }; diff --git a/crates/storybook2/src/stories/auto_height_editor.rs b/crates/storybook2/src/stories/auto_height_editor.rs index d4fda251d7..e6d449008d 100644 --- a/crates/storybook2/src/stories/auto_height_editor.rs +++ b/crates/storybook2/src/stories/auto_height_editor.rs @@ -1,7 +1,7 @@ use editor::Editor; use gpui::{ - div, white, Div, KeyBinding, ParentElement, Render, Styled, View, ViewContext, VisualContext, - WindowContext, + div, white, Element, KeyBinding, ParentElement, Render, Styled, View, ViewContext, + VisualContext, WindowContext, }; pub struct AutoHeightEditorStory { @@ -22,9 +22,7 @@ impl AutoHeightEditorStory { } impl Render for AutoHeightEditorStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { div() .size_full() .bg(white()) diff --git a/crates/storybook2/src/stories/cursor.rs b/crates/storybook2/src/stories/cursor.rs index af8d7440a0..ebd4d2d8e9 100644 --- a/crates/storybook2/src/stories/cursor.rs +++ b/crates/storybook2/src/stories/cursor.rs @@ -5,9 +5,7 @@ use ui::prelude::*; pub struct CursorStory; impl Render for CursorStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { let all_cursors: [(&str, Box) -> Stateful
>); 19] = [ ( "cursor_default", diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rs index 8ee10b6570..a622a55192 100644 --- a/crates/storybook2/src/stories/focus.rs +++ b/crates/storybook2/src/stories/focus.rs @@ -1,6 +1,5 @@ use gpui::{ - actions, div, prelude::*, Div, FocusHandle, Focusable, KeyBinding, Render, Stateful, - Subscription, View, WindowContext, + actions, div, prelude::*, FocusHandle, KeyBinding, Render, Subscription, View, WindowContext, }; use ui::prelude::*; @@ -57,9 +56,7 @@ impl FocusStory { } impl Render for FocusStory { - type Output = Focusable>; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { let theme = cx.theme(); let color_1 = theme.status().created; let color_2 = theme.status().modified; diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs index d659827990..efc3540458 100644 --- a/crates/storybook2/src/stories/kitchen_sink.rs +++ b/crates/storybook2/src/stories/kitchen_sink.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Div, Render, Stateful, View}; +use gpui::{prelude::*, Render, View}; use story::Story; use strum::IntoEnumIterator; use ui::prelude::*; @@ -14,9 +14,7 @@ impl KitchenSinkStory { } impl Render for KitchenSinkStory { - type Output = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let component_stories = ComponentStory::iter() .map(|selector| selector.story(cx)) .collect::>(); diff --git a/crates/storybook2/src/stories/overflow_scroll.rs b/crates/storybook2/src/stories/overflow_scroll.rs index 6adc6576ac..bdd405eccf 100644 --- a/crates/storybook2/src/stories/overflow_scroll.rs +++ b/crates/storybook2/src/stories/overflow_scroll.rs @@ -1,4 +1,4 @@ -use gpui::{Div, Render}; +use gpui::Render; use story::Story; use ui::prelude::*; @@ -6,9 +6,7 @@ use ui::prelude::*; pub struct OverflowScrollStory; impl Render for OverflowScrollStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { Story::container() .child(Story::title("Overflow Scroll")) .child(Story::label("`overflow_x_scroll`")) diff --git a/crates/storybook2/src/stories/picker.rs b/crates/storybook2/src/stories/picker.rs index 85985c5ae3..571e01af30 100644 --- a/crates/storybook2/src/stories/picker.rs +++ b/crates/storybook2/src/stories/picker.rs @@ -1,7 +1,5 @@ use fuzzy::StringMatchCandidate; -use gpui::{ - div, prelude::*, Div, KeyBinding, Render, SharedString, Styled, Task, View, WindowContext, -}; +use gpui::{div, prelude::*, KeyBinding, Render, SharedString, Styled, Task, View, WindowContext}; use picker::{Picker, PickerDelegate}; use std::sync::Arc; use ui::{prelude::*, ListItemSpacing}; @@ -202,9 +200,7 @@ impl PickerStory { } impl Render for PickerStory { - type Output = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { div() .bg(cx.theme().styles.colors.background) .size_full() diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs index 8d8543304d..0ea1582e0b 100644 --- a/crates/storybook2/src/stories/scroll.rs +++ b/crates/storybook2/src/stories/scroll.rs @@ -1,4 +1,4 @@ -use gpui::{div, prelude::*, px, Div, Render, SharedString, Stateful, Styled, View, WindowContext}; +use gpui::{div, prelude::*, px, Render, SharedString, Styled, View, WindowContext}; use ui::prelude::*; use ui::Tooltip; @@ -11,9 +11,7 @@ impl ScrollStory { } impl Render for ScrollStory { - type Output = Stateful
; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { let theme = cx.theme(); let color_1 = theme.status().created; let color_2 = theme.status().modified; diff --git a/crates/storybook2/src/stories/text.rs b/crates/storybook2/src/stories/text.rs index b044f7ce9a..cc25b8336b 100644 --- a/crates/storybook2/src/stories/text.rs +++ b/crates/storybook2/src/stories/text.rs @@ -1,6 +1,6 @@ use gpui::{ - div, green, red, Component, HighlightStyle, InteractiveText, IntoElement, ParentElement, - Render, Styled, StyledText, View, VisualContext, WindowContext, + div, green, red, Element, HighlightStyle, InteractiveText, IntoElement, ParentElement, Render, + Styled, StyledText, View, VisualContext, WindowContext, }; use indoc::indoc; use story::*; @@ -14,9 +14,7 @@ impl TextStory { } impl Render for TextStory { - type Output = Component; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl Element { StoryContainer::new("Text Story", "crates/storybook2/src/stories/text.rs") .children( vec![ diff --git a/crates/storybook2/src/stories/viewport_units.rs b/crates/storybook2/src/stories/viewport_units.rs index 746f385ab5..3114420085 100644 --- a/crates/storybook2/src/stories/viewport_units.rs +++ b/crates/storybook2/src/stories/viewport_units.rs @@ -1,4 +1,4 @@ -use gpui::{Div, Render}; +use gpui::Render; use story::Story; use ui::prelude::*; @@ -6,9 +6,7 @@ use ui::prelude::*; pub struct ViewportUnitsStory; impl Render for ViewportUnitsStory { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { Story::container().child( div() .flex() diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs index 1f7141fbfd..4ae6279d75 100644 --- a/crates/storybook2/src/stories/z_index.rs +++ b/crates/storybook2/src/stories/z_index.rs @@ -7,9 +7,7 @@ use ui::prelude::*; pub struct ZIndexStory; impl Render for ZIndexStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { Story::container().child(Story::title("z-index")).child( div() .flex() diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs index 4fdf65f673..dec1aa6d5c 100644 --- a/crates/storybook2/src/storybook2.rs +++ b/crates/storybook2/src/storybook2.rs @@ -7,8 +7,8 @@ use std::sync::Arc; use clap::Parser; use dialoguer::FuzzySelect; use gpui::{ - div, px, size, AnyView, AppContext, Bounds, Div, Render, ViewContext, VisualContext, - WindowBounds, WindowOptions, + div, px, size, AnyView, AppContext, Bounds, Render, ViewContext, VisualContext, WindowBounds, + WindowOptions, }; use log::LevelFilter; use settings2::{default_settings, Settings, SettingsStore}; @@ -113,9 +113,7 @@ impl StoryWrapper { } impl Render for StoryWrapper { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { div() .flex() .flex_col() diff --git a/crates/terminal_view2/src/terminal_panel.rs b/crates/terminal_view2/src/terminal_panel.rs index 746c2480c0..a5be8a01ff 100644 --- a/crates/terminal_view2/src/terminal_panel.rs +++ b/crates/terminal_view2/src/terminal_panel.rs @@ -3,7 +3,7 @@ use std::{path::PathBuf, sync::Arc}; use crate::TerminalView; use db::kvp::KEY_VALUE_STORE; use gpui::{ - actions, div, serde_json, AppContext, AsyncWindowContext, Div, Entity, EventEmitter, + actions, div, serde_json, AppContext, AsyncWindowContext, Element, Entity, EventEmitter, ExternalPaths, FocusHandle, FocusableView, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext, }; @@ -329,9 +329,7 @@ impl TerminalPanel { impl EventEmitter for TerminalPanel {} impl Render for TerminalPanel { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { div().size_full().child(self.pane.clone()) } } diff --git a/crates/terminal_view2/src/terminal_view.rs b/crates/terminal_view2/src/terminal_view.rs index 231de1444a..ad45a2ba3d 100644 --- a/crates/terminal_view2/src/terminal_view.rs +++ b/crates/terminal_view2/src/terminal_view.rs @@ -6,9 +6,9 @@ pub mod terminal_panel; // use crate::terminal_element::TerminalElement; use editor::{scroll::autoscroll::Autoscroll, Editor}; use gpui::{ - div, impl_actions, overlay, AnyElement, AppContext, DismissEvent, Div, EventEmitter, - FocusHandle, Focusable, FocusableView, KeyContext, KeyDownEvent, Keystroke, Model, MouseButton, - MouseDownEvent, Pixels, Render, Styled, Subscription, Task, View, VisualContext, WeakView, + div, impl_actions, overlay, AnyElement, AppContext, DismissEvent, EventEmitter, FocusHandle, + FocusableView, KeyContext, KeyDownEvent, Keystroke, Model, MouseButton, MouseDownEvent, Pixels, + Render, Styled, Subscription, Task, View, VisualContext, WeakView, }; use language::Bias; use persistence::TERMINAL_DB; @@ -617,9 +617,7 @@ impl TerminalView { } impl Render for TerminalView { - type Output = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let terminal_handle = self.terminal.clone(); let focused = self.focus_handle.is_focused(cx); diff --git a/crates/theme2/src/styles/stories/color.rs b/crates/theme2/src/styles/stories/color.rs index a7d8885848..f406f64cec 100644 --- a/crates/theme2/src/styles/stories/color.rs +++ b/crates/theme2/src/styles/stories/color.rs @@ -1,5 +1,5 @@ use gpui::prelude::*; -use gpui::{div, px, Div, ViewContext}; +use gpui::{div, px, ViewContext}; use story::Story; use crate::{default_color_scales, ColorScaleStep}; @@ -7,9 +7,7 @@ use crate::{default_color_scales, ColorScaleStep}; pub struct ColorsStory; impl Render for ColorsStory { - type Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { let color_scales = default_color_scales(); Story::container().child(Story::title("Colors")).child( diff --git a/crates/theme2/src/styles/stories/players.rs b/crates/theme2/src/styles/stories/players.rs index 237f2f1081..d7ab054b2d 100644 --- a/crates/theme2/src/styles/stories/players.rs +++ b/crates/theme2/src/styles/stories/players.rs @@ -1,4 +1,4 @@ -use gpui::{div, img, px, Div, ParentElement, Render, Styled, ViewContext}; +use gpui::{div, img, px, Element, ParentElement, Render, Styled, ViewContext}; use story::Story; use crate::{ActiveTheme, PlayerColors}; @@ -6,9 +6,7 @@ use crate::{ActiveTheme, PlayerColors}; pub struct PlayerStory; impl Render for PlayerStory { - type Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { Story::container().child( div() .flex() diff --git a/crates/theme_selector2/src/theme_selector.rs b/crates/theme_selector2/src/theme_selector.rs index 240742025e..ac3a52f2b9 100644 --- a/crates/theme_selector2/src/theme_selector.rs +++ b/crates/theme_selector2/src/theme_selector.rs @@ -2,7 +2,7 @@ use feature_flags::FeatureFlagAppExt; use fs::Fs; use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; use gpui::{ - actions, AppContext, DismissEvent, Div, EventEmitter, FocusableView, Render, View, ViewContext, + actions, AppContext, DismissEvent, EventEmitter, FocusableView, Render, View, ViewContext, VisualContext, WeakView, }; use picker::{Picker, PickerDelegate}; @@ -67,9 +67,7 @@ impl FocusableView for ThemeSelector { } impl Render for ThemeSelector { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { v_stack().w(rems(34.)).child(self.picker.clone()) } } diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs index 3ea5e9bc5f..52ba2cedb2 100644 --- a/crates/ui2/src/components/context_menu.rs +++ b/crates/ui2/src/components/context_menu.rs @@ -3,8 +3,8 @@ use crate::{ ListSeparator, ListSubHeader, }; use gpui::{ - px, Action, AnyElement, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, - FocusableView, IntoElement, Render, Subscription, View, VisualContext, + px, Action, AnyElement, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, + IntoElement, Render, Subscription, View, VisualContext, }; use menu::{SelectFirst, SelectLast, SelectNext, SelectPrev}; use std::{rc::Rc, time::Duration}; @@ -232,9 +232,7 @@ impl ContextMenuItem { } impl Render for ContextMenu { - type Output = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, cx: &mut ViewContext) -> impl Element { div().elevation_2(cx).flex().flex_row().child( v_stack() .min_w(px(200.)) diff --git a/crates/ui2/src/components/stories/avatar.rs b/crates/ui2/src/components/stories/avatar.rs index 3b40f07c89..99e370993a 100644 --- a/crates/ui2/src/components/stories/avatar.rs +++ b/crates/ui2/src/components/stories/avatar.rs @@ -1,4 +1,4 @@ -use gpui::{Div, Render}; +use gpui::Render; use story::Story; use crate::prelude::*; @@ -7,9 +7,7 @@ use crate::Avatar; pub struct AvatarStory; impl Render for AvatarStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { Story::container() .child(Story::title_for::()) .child(Story::label("Default")) diff --git a/crates/ui2/src/components/stories/button.rs b/crates/ui2/src/components/stories/button.rs index 8066f77353..4ab8c33c8e 100644 --- a/crates/ui2/src/components/stories/button.rs +++ b/crates/ui2/src/components/stories/button.rs @@ -1,4 +1,4 @@ -use gpui::{Div, Render}; +use gpui::Render; use story::Story; use crate::{prelude::*, Icon}; @@ -7,9 +7,7 @@ use crate::{Button, ButtonStyle}; pub struct ButtonStory; impl Render for ButtonStory { - type Output = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Output { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { Story::container() .child(Story::title_for::