Remove some redundant entity clones (#36274)

`cx.entity()` already returns an owned entity, so there is no need for
these clones.

Release Notes:

- N/A
This commit is contained in:
Finn Evers 2025-08-15 22:27:44 +02:00 committed by GitHub
parent 7199c733b2
commit 3e0a755486
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 106 additions and 123 deletions

View file

@ -228,7 +228,7 @@ impl ContextPicker {
} }
fn build_menu(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Entity<ContextMenu> { fn build_menu(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Entity<ContextMenu> {
let context_picker = cx.entity().clone(); let context_picker = cx.entity();
let menu = ContextMenu::build(window, cx, move |menu, _window, cx| { let menu = ContextMenu::build(window, cx, move |menu, _window, cx| {
let recent = self.recent_entries(cx); let recent = self.recent_entries(cx);

View file

@ -72,7 +72,7 @@ pub fn init(
let Some(window) = window else { let Some(window) = window else {
return; return;
}; };
let workspace = cx.entity().clone(); let workspace = cx.entity();
InlineAssistant::update_global(cx, |inline_assistant, cx| { InlineAssistant::update_global(cx, |inline_assistant, cx| {
inline_assistant.register_workspace(&workspace, window, cx) inline_assistant.register_workspace(&workspace, window, cx)
}); });

View file

@ -163,7 +163,7 @@ impl Render for ProfileSelector {
.unwrap_or_else(|| "Unknown".into()); .unwrap_or_else(|| "Unknown".into());
if self.provider.profiles_supported(cx) { if self.provider.profiles_supported(cx) {
let this = cx.entity().clone(); let this = cx.entity();
let focus_handle = self.focus_handle.clone(); let focus_handle = self.focus_handle.clone();
let trigger_button = Button::new("profile-selector-model", selected_profile) let trigger_button = Button::new("profile-selector-model", selected_profile)
.label_size(LabelSize::Small) .label_size(LabelSize::Small)

View file

@ -674,7 +674,7 @@ impl ChatPanel {
}) })
}) })
.when_some(message_id, |el, message_id| { .when_some(message_id, |el, message_id| {
let this = cx.entity().clone(); let this = cx.entity();
el.child( el.child(
self.render_popover_button( self.render_popover_button(

View file

@ -95,7 +95,7 @@ pub fn init(cx: &mut App) {
.and_then(|room| room.read(cx).channel_id()); .and_then(|room| room.read(cx).channel_id());
if let Some(channel_id) = channel_id { if let Some(channel_id) = channel_id {
let workspace = cx.entity().clone(); let workspace = cx.entity();
window.defer(cx, move |window, cx| { window.defer(cx, move |window, cx| {
ChannelView::open(channel_id, None, workspace, window, cx) ChannelView::open(channel_id, None, workspace, window, cx)
.detach_and_log_err(cx) .detach_and_log_err(cx)
@ -1142,7 +1142,7 @@ impl CollabPanel {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let this = cx.entity().clone(); let this = cx.entity();
if !(role == proto::ChannelRole::Guest if !(role == proto::ChannelRole::Guest
|| role == proto::ChannelRole::Talker || role == proto::ChannelRole::Talker
|| role == proto::ChannelRole::Member) || role == proto::ChannelRole::Member)
@ -1272,7 +1272,7 @@ impl CollabPanel {
.channel_for_id(clipboard.channel_id) .channel_for_id(clipboard.channel_id)
.map(|channel| channel.name.clone()) .map(|channel| channel.name.clone())
}); });
let this = cx.entity().clone(); let this = cx.entity();
let context_menu = ContextMenu::build(window, cx, |mut context_menu, window, cx| { let context_menu = ContextMenu::build(window, cx, |mut context_menu, window, cx| {
if self.has_subchannels(ix) { if self.has_subchannels(ix) {
@ -1439,7 +1439,7 @@ impl CollabPanel {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let this = cx.entity().clone(); let this = cx.entity();
let in_room = ActiveCall::global(cx).read(cx).room().is_some(); let in_room = ActiveCall::global(cx).read(cx).room().is_some();
let context_menu = ContextMenu::build(window, cx, |mut context_menu, _, _| { let context_menu = ContextMenu::build(window, cx, |mut context_menu, _, _| {

View file

@ -586,7 +586,7 @@ impl ChannelModalDelegate {
return; return;
}; };
let user_id = membership.user.id; let user_id = membership.user.id;
let picker = cx.entity().clone(); let picker = cx.entity();
let context_menu = ContextMenu::build(window, cx, |mut menu, _window, _cx| { let context_menu = ContextMenu::build(window, cx, |mut menu, _window, _cx| {
let role = membership.role; let role = membership.role;

View file

@ -321,7 +321,7 @@ impl NotificationPanel {
.justify_end() .justify_end()
.child(Button::new("decline", "Decline").on_click({ .child(Button::new("decline", "Decline").on_click({
let notification = notification.clone(); let notification = notification.clone();
let entity = cx.entity().clone(); let entity = cx.entity();
move |_, _, cx| { move |_, _, cx| {
entity.update(cx, |this, cx| { entity.update(cx, |this, cx| {
this.respond_to_notification( this.respond_to_notification(
@ -334,7 +334,7 @@ impl NotificationPanel {
})) }))
.child(Button::new("accept", "Accept").on_click({ .child(Button::new("accept", "Accept").on_click({
let notification = notification.clone(); let notification = notification.clone();
let entity = cx.entity().clone(); let entity = cx.entity();
move |_, _, cx| { move |_, _, cx| {
entity.update(cx, |this, cx| { entity.update(cx, |this, cx| {
this.respond_to_notification( this.respond_to_notification(

View file

@ -291,7 +291,7 @@ pub(crate) fn new_debugger_pane(
let Some(project) = project.upgrade() else { let Some(project) = project.upgrade() else {
return ControlFlow::Break(()); return ControlFlow::Break(());
}; };
let this_pane = cx.entity().clone(); let this_pane = cx.entity();
let item = if tab.pane == this_pane { let item = if tab.pane == this_pane {
pane.item_for_index(tab.ix) pane.item_for_index(tab.ix)
} else { } else {
@ -502,7 +502,7 @@ pub(crate) fn new_debugger_pane(
.on_drag( .on_drag(
DraggedTab { DraggedTab {
item: item.boxed_clone(), item: item.boxed_clone(),
pane: cx.entity().clone(), pane: cx.entity(),
detail: 0, detail: 0,
is_active: selected, is_active: selected,
ix, ix,

View file

@ -127,7 +127,7 @@ impl Render for EditPredictionButton {
}), }),
); );
} }
let this = cx.entity().clone(); let this = cx.entity();
div().child( div().child(
PopoverMenu::new("copilot") PopoverMenu::new("copilot")
@ -182,7 +182,7 @@ impl Render for EditPredictionButton {
let icon = status.to_icon(); let icon = status.to_icon();
let tooltip_text = status.to_tooltip(); let tooltip_text = status.to_tooltip();
let has_menu = status.has_menu(); let has_menu = status.has_menu();
let this = cx.entity().clone(); let this = cx.entity();
let fs = self.fs.clone(); let fs = self.fs.clone();
return div().child( return div().child(
@ -331,7 +331,7 @@ impl Render for EditPredictionButton {
}) })
}); });
let this = cx.entity().clone(); let this = cx.entity();
let mut popover_menu = PopoverMenu::new("zeta") let mut popover_menu = PopoverMenu::new("zeta")
.menu(move |window, cx| { .menu(move |window, cx| {

View file

@ -74,7 +74,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let editor1 = cx.add_window({ let editor1 = cx.add_window({
let events = events.clone(); let events = events.clone();
|window, cx| { |window, cx| {
let entity = cx.entity().clone(); let entity = cx.entity();
cx.subscribe_in( cx.subscribe_in(
&entity, &entity,
window, window,
@ -95,7 +95,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let events = events.clone(); let events = events.clone();
|window, cx| { |window, cx| {
cx.subscribe_in( cx.subscribe_in(
&cx.entity().clone(), &cx.entity(),
window, window,
move |_, _, event: &EditorEvent, _, _| match event { move |_, _, event: &EditorEvent, _, _| match event {
EditorEvent::Edited { .. } => events.borrow_mut().push(("editor2", "edited")), EditorEvent::Edited { .. } => events.borrow_mut().push(("editor2", "edited")),
@ -19634,13 +19634,8 @@ fn test_crease_insertion_and_rendering(cx: &mut TestAppContext) {
editor.insert_creases(Some(crease), cx); editor.insert_creases(Some(crease), cx);
let snapshot = editor.snapshot(window, cx); let snapshot = editor.snapshot(window, cx);
let _div = snapshot.render_crease_toggle( let _div =
MultiBufferRow(1), snapshot.render_crease_toggle(MultiBufferRow(1), false, cx.entity(), window, cx);
false,
cx.entity().clone(),
window,
cx,
);
snapshot snapshot
}) })
.unwrap(); .unwrap();

View file

@ -7815,7 +7815,7 @@ impl Element for EditorElement {
min_lines, min_lines,
max_lines, max_lines,
} => { } => {
let editor_handle = cx.entity().clone(); let editor_handle = cx.entity();
let max_line_number_width = let max_line_number_width =
self.max_line_number_width(&editor.snapshot(window, cx), window); self.max_line_number_width(&editor.snapshot(window, cx), window);
window.request_measured_layout( window.request_measured_layout(

View file

@ -703,7 +703,7 @@ impl ExtensionsPage {
extension: &ExtensionMetadata, extension: &ExtensionMetadata,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> ExtensionCard { ) -> ExtensionCard {
let this = cx.entity().clone(); let this = cx.entity();
let status = Self::extension_status(&extension.id, cx); let status = Self::extension_status(&extension.id, cx);
let has_dev_extension = Self::dev_extension_exists(&extension.id, cx); let has_dev_extension = Self::dev_extension_exists(&extension.id, cx);

View file

@ -3410,7 +3410,7 @@ impl GitPanel {
* MAX_PANEL_EDITOR_LINES * MAX_PANEL_EDITOR_LINES
+ gap; + gap;
let git_panel = cx.entity().clone(); let git_panel = cx.entity();
let display_name = SharedString::from(Arc::from( let display_name = SharedString::from(Arc::from(
active_repository active_repository
.read(cx) .read(cx)

View file

@ -595,9 +595,7 @@ impl Render for TextInput {
.w_full() .w_full()
.p(px(4.)) .p(px(4.))
.bg(white()) .bg(white())
.child(TextElement { .child(TextElement { input: cx.entity() }),
input: cx.entity().clone(),
}),
) )
} }
} }

View file

@ -1358,7 +1358,7 @@ impl Render for LspLogToolbarItemView {
}) })
.collect(); .collect();
let log_toolbar_view = cx.entity().clone(); let log_toolbar_view = cx.entity();
let lsp_menu = PopoverMenu::new("LspLogView") let lsp_menu = PopoverMenu::new("LspLogView")
.anchor(Corner::TopLeft) .anchor(Corner::TopLeft)

View file

@ -1007,7 +1007,7 @@ impl Render for LspTool {
(None, "All Servers Operational") (None, "All Servers Operational")
}; };
let lsp_tool = cx.entity().clone(); let lsp_tool = cx.entity();
div().child( div().child(
PopoverMenu::new("lsp-tool") PopoverMenu::new("lsp-tool")

View file

@ -456,7 +456,7 @@ impl SyntaxTreeToolbarItemView {
let active_layer = buffer_state.active_layer.clone()?; let active_layer = buffer_state.active_layer.clone()?;
let active_buffer = buffer_state.buffer.read(cx).snapshot(); let active_buffer = buffer_state.buffer.read(cx).snapshot();
let view = cx.entity().clone(); let view = cx.entity();
Some( Some(
PopoverMenu::new("Syntax Tree") PopoverMenu::new("Syntax Tree")
.trigger(Self::render_header(&active_layer)) .trigger(Self::render_header(&active_layer))

View file

@ -4815,51 +4815,45 @@ impl OutlinePanel {
.when(show_indent_guides, |list| { .when(show_indent_guides, |list| {
list.with_decoration( list.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx)) ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
.with_compute_indents_fn( .with_compute_indents_fn(cx.entity(), |outline_panel, range, _, _| {
cx.entity().clone(), let entries = outline_panel.cached_entries.get(range);
|outline_panel, range, _, _| { if let Some(entries) = entries {
let entries = outline_panel.cached_entries.get(range); entries.into_iter().map(|item| item.depth).collect()
if let Some(entries) = entries { } else {
entries.into_iter().map(|item| item.depth).collect() smallvec::SmallVec::new()
} else { }
smallvec::SmallVec::new() })
} .with_render_fn(cx.entity(), move |outline_panel, params, _, _| {
}, const LEFT_OFFSET: Pixels = px(14.);
)
.with_render_fn(
cx.entity().clone(),
move |outline_panel, params, _, _| {
const LEFT_OFFSET: Pixels = px(14.);
let indent_size = params.indent_size; let indent_size = params.indent_size;
let item_height = params.item_height; let item_height = params.item_height;
let active_indent_guide_ix = find_active_indent_guide_ix( let active_indent_guide_ix = find_active_indent_guide_ix(
outline_panel, outline_panel,
&params.indent_guides, &params.indent_guides,
); );
params params
.indent_guides .indent_guides
.into_iter() .into_iter()
.enumerate() .enumerate()
.map(|(ix, layout)| { .map(|(ix, layout)| {
let bounds = Bounds::new( let bounds = Bounds::new(
point( point(
layout.offset.x * indent_size + LEFT_OFFSET, layout.offset.x * indent_size + LEFT_OFFSET,
layout.offset.y * item_height, layout.offset.y * item_height,
), ),
size(px(1.), layout.length * item_height), size(px(1.), layout.length * item_height),
); );
ui::RenderedIndentGuide { ui::RenderedIndentGuide {
bounds, bounds,
layout, layout,
is_active: active_indent_guide_ix == Some(ix), is_active: active_indent_guide_ix == Some(ix),
hitbox: None, hitbox: None,
} }
}) })
.collect() .collect()
}, }),
),
) )
}) })
}; };

View file

@ -5351,26 +5351,22 @@ impl Render for ProjectPanel {
.when(show_indent_guides, |list| { .when(show_indent_guides, |list| {
list.with_decoration( list.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx)) ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
.with_compute_indents_fn( .with_compute_indents_fn(cx.entity(), |this, range, window, cx| {
cx.entity().clone(), let mut items =
|this, range, window, cx| { SmallVec::with_capacity(range.end - range.start);
let mut items = this.iter_visible_entries(
SmallVec::with_capacity(range.end - range.start); range,
this.iter_visible_entries( window,
range, cx,
window, |entry, _, entries, _, _| {
cx, let (depth, _) = Self::calculate_depth_and_difference(
|entry, _, entries, _, _| { entry, entries,
let (depth, _) = );
Self::calculate_depth_and_difference( items.push(depth);
entry, entries, },
); );
items.push(depth); items
}, })
);
items
},
)
.on_click(cx.listener( .on_click(cx.listener(
|this, active_indent_guide: &IndentGuideLayout, window, cx| { |this, active_indent_guide: &IndentGuideLayout, window, cx| {
if window.modifiers().secondary() { if window.modifiers().secondary() {
@ -5394,7 +5390,7 @@ impl Render for ProjectPanel {
} }
}, },
)) ))
.with_render_fn(cx.entity().clone(), move |this, params, _, cx| { .with_render_fn(cx.entity(), move |this, params, _, cx| {
const LEFT_OFFSET: Pixels = px(14.); const LEFT_OFFSET: Pixels = px(14.);
const PADDING_Y: Pixels = px(4.); const PADDING_Y: Pixels = px(4.);
const HITBOX_OVERDRAW: Pixels = px(3.); const HITBOX_OVERDRAW: Pixels = px(3.);
@ -5447,7 +5443,7 @@ impl Render for ProjectPanel {
}) })
.when(show_sticky_entries, |list| { .when(show_sticky_entries, |list| {
let sticky_items = ui::sticky_items( let sticky_items = ui::sticky_items(
cx.entity().clone(), cx.entity(),
|this, range, window, cx| { |this, range, window, cx| {
let mut items = SmallVec::with_capacity(range.end - range.start); let mut items = SmallVec::with_capacity(range.end - range.start);
this.iter_visible_entries( this.iter_visible_entries(
@ -5474,7 +5470,7 @@ impl Render for ProjectPanel {
list.with_decoration(if show_indent_guides { list.with_decoration(if show_indent_guides {
sticky_items.with_decoration( sticky_items.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx)) ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
.with_render_fn(cx.entity().clone(), move |_, params, _, _| { .with_render_fn(cx.entity(), move |_, params, _, _| {
const LEFT_OFFSET: Pixels = px(14.); const LEFT_OFFSET: Pixels = px(14.);
let indent_size = params.indent_size; let indent_size = params.indent_size;

View file

@ -1292,7 +1292,7 @@ impl RemoteServerProjects {
let connection_string = connection_string.clone(); let connection_string = connection_string.clone();
move |_, _: &menu::Confirm, window, cx| { move |_, _: &menu::Confirm, window, cx| {
remove_ssh_server( remove_ssh_server(
cx.entity().clone(), cx.entity(),
server_index, server_index,
connection_string.clone(), connection_string.clone(),
window, window,
@ -1312,7 +1312,7 @@ impl RemoteServerProjects {
.child(Label::new("Remove Server").color(Color::Error)) .child(Label::new("Remove Server").color(Color::Error))
.on_click(cx.listener(move |_, _, window, cx| { .on_click(cx.listener(move |_, _, window, cx| {
remove_ssh_server( remove_ssh_server(
cx.entity().clone(), cx.entity(),
server_index, server_index,
connection_string.clone(), connection_string.clone(),
window, window,

View file

@ -244,7 +244,7 @@ impl Session {
repl_session_id = cx.entity_id().to_string(), repl_session_id = cx.entity_id().to_string(),
); );
let session_view = cx.entity().clone(); let session_view = cx.entity();
let kernel = match self.kernel_specification.clone() { let kernel = match self.kernel_specification.clone() {
KernelSpecification::Jupyter(kernel_specification) KernelSpecification::Jupyter(kernel_specification)

View file

@ -65,7 +65,7 @@ impl Render for IndentGuidesStory {
}, },
) )
.with_compute_indents_fn( .with_compute_indents_fn(
cx.entity().clone(), cx.entity(),
|this, range, _cx, _context| { |this, range, _cx, _context| {
this.depths this.depths
.iter() .iter()

View file

@ -947,7 +947,7 @@ pub fn new_terminal_pane(
cx: &mut Context<TerminalPanel>, cx: &mut Context<TerminalPanel>,
) -> Entity<Pane> { ) -> Entity<Pane> {
let is_local = project.read(cx).is_local(); let is_local = project.read(cx).is_local();
let terminal_panel = cx.entity().clone(); let terminal_panel = cx.entity();
let pane = cx.new(|cx| { let pane = cx.new(|cx| {
let mut pane = Pane::new( let mut pane = Pane::new(
workspace.clone(), workspace.clone(),
@ -1009,7 +1009,7 @@ pub fn new_terminal_pane(
return ControlFlow::Break(()); return ControlFlow::Break(());
}; };
if let Some(tab) = dropped_item.downcast_ref::<DraggedTab>() { if let Some(tab) = dropped_item.downcast_ref::<DraggedTab>() {
let this_pane = cx.entity().clone(); let this_pane = cx.entity();
let item = if tab.pane == this_pane { let item = if tab.pane == this_pane {
pane.item_for_index(tab.ix) pane.item_for_index(tab.ix)
} else { } else {

View file

@ -1491,7 +1491,7 @@ impl TerminalView {
impl Render for TerminalView { impl Render for TerminalView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let terminal_handle = self.terminal.clone(); let terminal_handle = self.terminal.clone();
let terminal_view_handle = cx.entity().clone(); let terminal_view_handle = cx.entity();
let focused = self.focus_handle.is_focused(window); let focused = self.focus_handle.is_focused(window);

View file

@ -20,7 +20,7 @@ impl ModeIndicator {
}) })
.detach(); .detach();
let handle = cx.entity().clone(); let handle = cx.entity();
let window_handle = window.window_handle(); let window_handle = window.window_handle();
cx.observe_new::<Vim>(move |_, window, cx| { cx.observe_new::<Vim>(move |_, window, cx| {
let Some(window) = window else { let Some(window) = window else {
@ -29,7 +29,7 @@ impl ModeIndicator {
if window.window_handle() != window_handle { if window.window_handle() != window_handle {
return; return;
} }
let vim = cx.entity().clone(); let vim = cx.entity();
handle.update(cx, |_, cx| { handle.update(cx, |_, cx| {
cx.subscribe(&vim, |mode_indicator, vim, event, cx| match event { cx.subscribe(&vim, |mode_indicator, vim, event, cx| match event {
VimEvent::Focused => { VimEvent::Focused => {

View file

@ -332,7 +332,7 @@ impl Vim {
Vim::take_forced_motion(cx); Vim::take_forced_motion(cx);
let prior_selections = self.editor_selections(window, cx); let prior_selections = self.editor_selections(window, cx);
let cursor_word = self.editor_cursor_word(window, cx); let cursor_word = self.editor_cursor_word(window, cx);
let vim = cx.entity().clone(); let vim = cx.entity();
let searched = pane.update(cx, |pane, cx| { let searched = pane.update(cx, |pane, cx| {
self.search.direction = direction; self.search.direction = direction;

View file

@ -402,7 +402,7 @@ impl Vim {
const NAMESPACE: &'static str = "vim"; const NAMESPACE: &'static str = "vim";
pub fn new(window: &mut Window, cx: &mut Context<Editor>) -> Entity<Self> { pub fn new(window: &mut Window, cx: &mut Context<Editor>) -> Entity<Self> {
let editor = cx.entity().clone(); let editor = cx.entity();
let mut initial_mode = VimSettings::get_global(cx).default_mode; let mut initial_mode = VimSettings::get_global(cx).default_mode;
if initial_mode == Mode::Normal && HelixModeSetting::get_global(cx).0 { if initial_mode == Mode::Normal && HelixModeSetting::get_global(cx).0 {

View file

@ -253,7 +253,7 @@ impl Dock {
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) -> Entity<Self> { ) -> Entity<Self> {
let focus_handle = cx.focus_handle(); let focus_handle = cx.focus_handle();
let workspace = cx.entity().clone(); let workspace = cx.entity();
let dock = cx.new(|cx| { let dock = cx.new(|cx| {
let focus_subscription = let focus_subscription =
cx.on_focus(&focus_handle, window, |dock: &mut Dock, window, cx| { cx.on_focus(&focus_handle, window, |dock: &mut Dock, window, cx| {

View file

@ -346,7 +346,7 @@ impl Render for LanguageServerPrompt {
) )
.child(Label::new(request.message.to_string()).size(LabelSize::Small)) .child(Label::new(request.message.to_string()).size(LabelSize::Small))
.children(request.actions.iter().enumerate().map(|(ix, action)| { .children(request.actions.iter().enumerate().map(|(ix, action)| {
let this_handle = cx.entity().clone(); let this_handle = cx.entity();
Button::new(ix, action.title.clone()) Button::new(ix, action.title.clone())
.size(ButtonSize::Large) .size(ButtonSize::Large)
.on_click(move |_, window, cx| { .on_click(move |_, window, cx| {

View file

@ -2198,7 +2198,7 @@ impl Pane {
fn update_status_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) { fn update_status_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let workspace = self.workspace.clone(); let workspace = self.workspace.clone();
let pane = cx.entity().clone(); let pane = cx.entity();
window.defer(cx, move |window, cx| { window.defer(cx, move |window, cx| {
let Ok(status_bar) = let Ok(status_bar) =
@ -2279,7 +2279,7 @@ impl Pane {
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
maybe!({ maybe!({
let pane = cx.entity().clone(); let pane = cx.entity();
let destination_index = match operation { let destination_index = match operation {
PinOperation::Pin => self.pinned_tab_count.min(ix), PinOperation::Pin => self.pinned_tab_count.min(ix),
@ -2473,7 +2473,7 @@ impl Pane {
.on_drag( .on_drag(
DraggedTab { DraggedTab {
item: item.boxed_clone(), item: item.boxed_clone(),
pane: cx.entity().clone(), pane: cx.entity(),
detail, detail,
is_active, is_active,
ix, ix,
@ -2832,7 +2832,7 @@ impl Pane {
let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft) let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.on_click({ .on_click({
let entity = cx.entity().clone(); let entity = cx.entity();
move |_, window, cx| { move |_, window, cx| {
entity.update(cx, |pane, cx| pane.navigate_backward(window, cx)) entity.update(cx, |pane, cx| pane.navigate_backward(window, cx))
} }
@ -2848,7 +2848,7 @@ impl Pane {
let navigate_forward = IconButton::new("navigate_forward", IconName::ArrowRight) let navigate_forward = IconButton::new("navigate_forward", IconName::ArrowRight)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.on_click({ .on_click({
let entity = cx.entity().clone(); let entity = cx.entity();
move |_, window, cx| entity.update(cx, |pane, cx| pane.navigate_forward(window, cx)) move |_, window, cx| entity.update(cx, |pane, cx| pane.navigate_forward(window, cx))
}) })
.disabled(!self.can_navigate_forward()) .disabled(!self.can_navigate_forward())
@ -3054,7 +3054,7 @@ impl Pane {
return; return;
} }
} }
let mut to_pane = cx.entity().clone(); let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction; let split_direction = self.drag_split_direction;
let item_id = dragged_tab.item.item_id(); let item_id = dragged_tab.item.item_id();
if let Some(preview_item_id) = self.preview_item_id { if let Some(preview_item_id) = self.preview_item_id {
@ -3163,7 +3163,7 @@ impl Pane {
return; return;
} }
} }
let mut to_pane = cx.entity().clone(); let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction; let split_direction = self.drag_split_direction;
let project_entry_id = *project_entry_id; let project_entry_id = *project_entry_id;
self.workspace self.workspace
@ -3239,7 +3239,7 @@ impl Pane {
return; return;
} }
} }
let mut to_pane = cx.entity().clone(); let mut to_pane = cx.entity();
let mut split_direction = self.drag_split_direction; let mut split_direction = self.drag_split_direction;
let paths = paths.paths().to_vec(); let paths = paths.paths().to_vec();
let is_remote = self let is_remote = self

View file

@ -6338,7 +6338,7 @@ impl Render for Workspace {
.border_b_1() .border_b_1()
.border_color(colors.border) .border_color(colors.border)
.child({ .child({
let this = cx.entity().clone(); let this = cx.entity();
canvas( canvas(
move |bounds, window, cx| { move |bounds, window, cx| {
this.update(cx, |this, cx| { this.update(cx, |this, cx| {

View file

@ -319,7 +319,7 @@ pub fn initialize_workspace(
return; return;
}; };
let workspace_handle = cx.entity().clone(); let workspace_handle = cx.entity();
let center_pane = workspace.active_pane().clone(); let center_pane = workspace.active_pane().clone();
initialize_pane(workspace, &center_pane, window, cx); initialize_pane(workspace, &center_pane, window, cx);