From 51d1d92d66df906e0f211973738a00ed1e017f18 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 30 Dec 2023 08:58:07 -0700 Subject: [PATCH 1/5] Attempt to return impl Element from render. 3 errors. --- .../src/activity_indicator.rs | 8 +++----- crates/assistant2/src/assistant_panel.rs | 18 ++++++------------ crates/auto_update2/src/update_notification.rs | 6 ++---- crates/breadcrumbs2/src/breadcrumbs.rs | 6 ++---- crates/collab_ui2/src/channel_view.rs | 6 ++---- crates/collab_ui2/src/chat_panel.rs | 8 +++----- .../src/chat_panel/message_editor.rs | 6 ++---- crates/collab_ui2/src/collab_panel.rs | 14 +++++--------- .../src/collab_panel/channel_modal.rs | 10 ++++------ .../src/collab_panel/contact_finder.rs | 8 +++----- crates/collab_ui2/src/collab_titlebar_item.rs | 8 +++----- crates/collab_ui2/src/notification_panel.rs | 12 ++++-------- .../incoming_call_notification.rs | 6 ++---- .../project_shared_notification.rs | 8 ++------ crates/command_palette2/src/command_palette.rs | 6 ++---- crates/copilot2/src/sign_in.rs | 10 ++++------ crates/copilot_button2/src/copilot_button.rs | 8 +++----- crates/diagnostics2/src/diagnostics.rs | 12 +++++------- crates/diagnostics2/src/items.rs | 6 ++---- crates/diagnostics2/src/toolbar_controls.rs | 6 ++---- crates/editor2/src/editor.rs | 4 +--- crates/editor2/src/items.rs | 6 ++---- crates/feedback2/src/deploy_feedback_button.rs | 6 ++---- crates/feedback2/src/feedback_modal.rs | 8 +++----- crates/file_finder2/src/file_finder.rs | 6 ++---- crates/go_to_line2/src/go_to_line.rs | 9 +++------ crates/gpui2/src/app/test_context.rs | 6 ++---- crates/gpui2/src/element.rs | 4 +--- crates/gpui2/src/interactive.rs | 14 +++++--------- crates/gpui2/src/view.rs | 12 ------------ crates/gpui2_macros/src/derive_render.rs | 4 +--- .../src/active_buffer_language.rs | 6 ++---- .../src/language_selector.rs | 6 ++---- crates/language_tools2/src/lsp_log.rs | 18 ++++++++---------- crates/language_tools2/src/syntax_tree_view.rs | 10 +++------- crates/outline2/src/outline.rs | 6 ++---- crates/picker2/src/picker2.rs | 10 ++++------ crates/project_panel2/src/project_panel.rs | 16 ++++++---------- .../quick_action_bar2/src/quick_action_bar.rs | 8 +++----- crates/recent_projects2/src/recent_projects.rs | 8 +++----- crates/search2/src/buffer_search.rs | 6 ++---- crates/search2/src/project_search.rs | 18 +++++++----------- .../src/stories/auto_height_editor.rs | 8 +++----- crates/storybook2/src/stories/cursor.rs | 4 +--- crates/storybook2/src/stories/focus.rs | 7 ++----- crates/storybook2/src/stories/kitchen_sink.rs | 6 ++---- .../storybook2/src/stories/overflow_scroll.rs | 6 ++---- crates/storybook2/src/stories/picker.rs | 8 ++------ crates/storybook2/src/stories/scroll.rs | 6 ++---- crates/storybook2/src/stories/text.rs | 8 +++----- .../storybook2/src/stories/viewport_units.rs | 6 ++---- crates/storybook2/src/stories/z_index.rs | 4 +--- crates/storybook2/src/storybook2.rs | 8 +++----- crates/terminal_view2/src/terminal_panel.rs | 6 ++---- crates/terminal_view2/src/terminal_view.rs | 10 ++++------ crates/theme_selector2/src/theme_selector.rs | 6 ++---- crates/ui2/src/components/context_menu.rs | 8 +++----- crates/ui2/src/components/stories/avatar.rs | 6 ++---- crates/ui2/src/components/stories/button.rs | 6 ++---- crates/ui2/src/components/stories/checkbox.rs | 6 ++---- .../ui2/src/components/stories/context_menu.rs | 6 ++---- .../ui2/src/components/stories/disclosure.rs | 6 ++---- crates/ui2/src/components/stories/icon.rs | 6 ++---- .../ui2/src/components/stories/icon_button.rs | 6 ++---- .../ui2/src/components/stories/keybinding.rs | 6 ++---- crates/ui2/src/components/stories/label.rs | 10 +++------- crates/ui2/src/components/stories/list.rs | 6 ++---- .../ui2/src/components/stories/list_header.rs | 6 ++---- crates/ui2/src/components/stories/list_item.rs | 6 ++---- crates/ui2/src/components/stories/tab.rs | 6 ++---- crates/ui2/src/components/stories/tab_bar.rs | 6 ++---- .../src/components/stories/toggle_button.rs | 6 ++---- crates/ui2/src/components/tooltip.rs | 6 ++---- crates/vcs_menu2/src/lib.rs | 6 ++---- crates/vim2/src/mode_indicator.rs | 6 ++---- crates/welcome2/src/base_keymap_picker.rs | 4 +--- crates/welcome2/src/welcome.rs | 10 ++++------ crates/workspace2/src/dock.rs | 16 +++++----------- crates/workspace2/src/item.rs | 10 ++++------ crates/workspace2/src/modal_layer.rs | 8 +++----- crates/workspace2/src/notifications.rs | 8 +++----- crates/workspace2/src/pane.rs | 13 ++++--------- crates/workspace2/src/shared_screen.rs | 10 ++++------ crates/workspace2/src/status_bar.rs | 6 ++---- crates/workspace2/src/toolbar.rs | 8 +++----- crates/workspace2/src/workspace2.rs | 4 +--- 86 files changed, 230 insertions(+), 443 deletions(-) diff --git a/crates/activity_indicator2/src/activity_indicator.rs b/crates/activity_indicator2/src/activity_indicator.rs index 2b7846cd8d96a9c9014c0e4ab05595df4757509e..cbb6daca771c68d64524a458d80b0d8ea1a80587 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 bcfb5f0fbc9ae2409b999e4d8698707d2b1f7db5..5318096f57b4da61a936daf463073facd6b17f67 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 Element = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 8bb08912b01a13712afe2dbc14e34a9abd49bc24..009972b7ee97656abf8bf2e40a9b15b76047da5f 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 Element = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 da7182ec2c7394512e0ffafef2fcdf0c5cb7936f..6750a95eb2db936a4a6e8dad20f16fbcc90ed1c8 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 0fbe625fe028cc0c203bf679a5c471811db296de..04ca5119050a74a6da045e194b11a9f49094a69c 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 Element = AnyView; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { - 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 03e9cfbb4ad64317ede58045ec2a622eda0681ad..07460e26202956dfee4f4991cd5a0ff8a47d4ed0 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 0b9d0be0b40b6db762f468b7d21f479fde1ea548..d30a1009b67fdb9664025bcca4f2438502b0a1f3 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 Element = AnyView; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 8fd90af45b40cce837160c886cb5542e9a11e94c..1fb2f94f0acde5e11844977309b091b80ccf4fcd 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 Element = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 d68aa32e9b339159062d36a08cf402c610c7d781..30fbe6cd552daebba7cef3cfbb552aae4562619c 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 a38d22c096b0caffc5f6f3ba520ba79ecc2a8924..da91feafe1e8ae3805b731d11e10d7260a047ee9 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::Element { + 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 Element = 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 6255e2b833daf2028675fba197bc80d28a1fdea4..4d2362c4194c13077695ec8af23afe974d625a4c 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 4b2f38de9b8aad0072e7bc5320baaa7efc2e2779..f661318dc61e2485b1b196d2cf8c2c701c32e7b6 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 Element = 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 d5bdf4ff446887cd69cfe96676aec6964b9e0c24..b7c7309414b233dacd3569b79c97c563479d33ff 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 707e961423472ddb8b032a253bb20ff66f2adbaa..baeade6ee5a4fb32ae80b0d52d1a6d60adbcabae 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 05891bc0f199a83c2eb911179d042c259a46702a..1a16af2b112d364e756100013c45ac8a2bae9b03 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 4fa93ffcf89a496ae1b150334c9b7a310b779cec..cee049a7060a048b7b95e872de5a95d24244b3c5 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 2c8427732e7043da64aa16b6e72547678f4d82df..06cacb0b07640eec61f2c1395ac8d5f4c319199e 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 8103231ede627616cd0c47b3f74125704c6fa5bf..c7ed7f84fbf521f95ff576095dad3f040915f7b9 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 Element = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 cc598ba90ca741e3b4024512544a81d0655d281c..959cf14fdbfc5f2f18e3067031027a5a3731b6e1 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 1a604b76c86503099239e06edc92a60604485ec0..0dc17f9320cd66142df1c6511a5bf42d725dbb3f 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 c9fb2fa181f4a1d9d06cfcb21e95c7bbd2c4c34a..7ddcbce273f89a4059c98524afa4ee549fad208e 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 Element = EditorElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 b10b891d0dbf1e3aa77e8c2a36d0a87add9a53d6..f1969ff93c459a12370778bb0119be5fd20d9f60 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 Element = Div; - - fn render(&mut self, _: &mut ViewContext) -> Self::Element { + 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 926a5d791e0550dd27c354a5cc6db3530518f189..0e0dae30ff440a35d3caea4557d6909a515dfd1a 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 Element = AnyElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 d22d5d908b1855abf8776f12c7699096c53f9c3d..1f701df8edbd74a9a7b819e284defd7e8ab69323 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 69deba6d2c0da701db779d7f5cc76e9fe5792448..8999a41dde7f54bbe6960561108a3f19b401eb4f 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 02fcd4771623494bd502b65ca81f900a06d34266..66a454f5f2568c365d965606def33758497bb4eb 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 c77ec29bdf288f1300210b4c2b82cedbf0aef3bc..55d493b87c7a92f7afd456030eebc9a9cba5cee3 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 Element = Div; - - fn render(&mut self, _cx: &mut crate::ViewContext) -> Self::Element { + 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 4201123a10110f540258b8afc462aeab63b3fb1a..eedc5e35b172fa4f061f26a3ba99b7ace26f0d6e 100644 --- a/crates/gpui2/src/element.rs +++ b/crates/gpui2/src/element.rs @@ -7,9 +7,7 @@ pub(crate) use smallvec::SmallVec; use std::{any::Any, fmt::Debug}; pub trait Render: 'static + Sized { - type Element: Element + 'static; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element; + fn render(&mut self, cx: &mut ViewContext) -> impl Element; } pub trait IntoElement: Sized { diff --git a/crates/gpui2/src/interactive.rs b/crates/gpui2/src/interactive.rs index 58ee849aad4a6d665c6ec14176f72eb457c9a82e..4f4c1630770b755fd9cbc9e8e874aea46e52473f 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 Element = Div; - - fn render(&mut self, _: &mut ViewContext) -> Self::Element { + 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 Element = Stateful
; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 1b4c2b6346fb56320737ab74a8057da589aba354..41d1be852cfd7e640f92c2e983a0c85ac6ed1c8d 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 Element = E; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { - (self)(cx) - } -} - mod any_view { use crate::{AnyElement, AnyView, Element, LayoutId, Render, WindowContext}; diff --git a/crates/gpui2_macros/src/derive_render.rs b/crates/gpui2_macros/src/derive_render.rs index 3983a572f06ae66bbff7686851bb369840213309..e5c147575d9a363ad18cdadb232f68d93d231215 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 Element = (); - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 48224198a2e13a1651102a7e26253b0a7b6568bb..434a6c44206842d37da7252d9c5d45dd5ea65cce 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 Element = 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 3da8649c6e006fcc56a0255ef96babf76121b881..7c0e5f9467ab6ba376d1ca801011081fb28fdf40 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 310726e4a525c0cbd77eb0ad7092e7f86fca7a27..6174511474ea99b5c8496ed62c05566f2c9cb9c3 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,10 @@ fn log_contents(lines: &VecDeque) -> String { } impl Render for LspLogView { - type Element = EditorElement; + fn render(&mut self, cx: &mut ViewContext) -> impl Element { + let _x = self.editor.update(cx, |editor, cx| editor.render(cx)); - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { - self.editor.update(cx, |editor, cx| editor.render(cx)) + div() } } @@ -709,9 +709,7 @@ impl ToolbarItemView for LspLogToolbarItemView { } impl Render for LspLogToolbarItemView { - type Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 e4ee4b0cfb6a7532670beb376262afeb6ca5be44..3b14b77582bee4db8b6ff9fd423ac5e86eaaa2c1 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 Element = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> Self::Element { + 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 Element = 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 ba67f33b25de382bdf0b4c30ec8bbf7d635c44b3..e9af96c1e5a53d5c4e4521194bc936f6e559491e 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 3abdf953b3469e2e932d2a5f441c90caa44d8f3a..e95c9af003d1c67023c0b7be2ac031a62237dec4 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 21a114c43c925dacdcfbe86da5b0af3f11960522..6a2e98ce5e7b126b070e77ca744ad10f5f3e1f02 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 Element = Focusable>; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 3eba0e60ec20672b0b759d5e041745eb6c46e162..5cbd1f6bcdd9b6208bfea6b90e695295c3f9343f 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 2d6f4bf0e3160a214bc7a25a24a10d94129c694f..5178c1d9d801da9f2f8c3c44473879cbce6cc922 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 4972908e0d4796fa60c14940158b20cedc6c24f8..02e664a10953e329fe703f7d900f7f49c5a59dd1 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 9a654c9bf4d9d62947f756457599c2ea4e59af5d..efb60c414c7d5aa47a895bd6c02a951916678545 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 Element = AnyElement; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 2f3089a4e6e766057559376f284e570b19701c5c..e6d449008d28e19a6cff84e6e153815ea3edf43f 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 7d4cf8145a034906bb87bb944ae926fff5ab9f3a..ebd4d2d8e9654ca1dd22e250cd0924c7514573b1 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 a3a8845947ddd1f78e57991aa701489087cc2033..a622a55192834ee8cf79bd64d5bc3f2649d0b13c 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 Element = Focusable>; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 271285cc2f56263593f2ed0a7691bd5ca649b5e3..efc3540458c94739f996f3d375c4fdbff1509a98 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 Element = Stateful
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 631b851304c3f0a23fd0333dec720306a270d903..bdd405eccf5c2ed17561adc69d93f3caa54ec524 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 edaaaa70bd1e8522785ded0c0771963505dbe2fd..571e01af30e3bc1c2a409041e697a79fd7a8b5de 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 Element = Div; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 300aae1144b1c2756c10b7d5a0a697c5448d8784..0ea1582e0b2fd342915706df9dd8cc70b152f40a 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 Element = Stateful
; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 99d722988d086d932c6bd734992720273f02e2e3..cc25b8336bffadd1835f594651f0002bbcd7d9ad 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 Element = Component; - - fn render(&mut self, cx: &mut gpui::ViewContext) -> Self::Element { + 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 8a95a6b66c30da05df7458988bf8362a25480d74..3114420085f452eccc5b712630ec5adc7b07a3ec 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 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/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs index 9579b8c7fcf891c4fcda7ef691d37f583b2bd77a..73d1abac55c93e87136169b57ab5d2a93777c3ff 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 523e93cf5267e310d691ee4ca19db1cc67cfbb4b..dec1aa6d5c3af4d2ec5f6192f5e6a4ad30e6e010 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 dd0c7d39995e539b542492b4b01ff52d60d7e82d..a5be8a01ffa030449cb02055e72e7aaccbf50067 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 6d18d6f8f95f3b1bb201217d5379a609e593ee00..ad45a2ba3d3c843bdb246e5b967db4a9836195d8 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 Element = Focusable
; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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/theme_selector2/src/theme_selector.rs b/crates/theme_selector2/src/theme_selector.rs index ae067ce87cfe037f8b75f0ca2f8edabfdb2f3bf7..ac3a52f2b99c5aececcb4d2babd687142711d5a5 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 6df6a290964b00f3ebdf455afb2feca594eee33e..52ba2cedb2e66446f9d9a442e7ad729bb90d4821 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 Element = Div; - - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + 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 09adfe480a434491ff6db2b4010ccbc611db51c7..99e370993a913454dde5553610db2ab881783866 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + 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 9fe4f55dcb35c820c4553ef23e462714a51da5a0..4ab8c33c8e9e8821889714b20084ee277d9d2422 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 Element = Div; - - fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> impl Element { Story::container() .child(Story::title_for::