Detailed changes
@@ -228,7 +228,7 @@ impl ContextPicker {
}
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 recent = self.recent_entries(cx);
@@ -72,7 +72,7 @@ pub fn init(
let Some(window) = window else {
return;
};
- let workspace = cx.entity().clone();
+ let workspace = cx.entity();
InlineAssistant::update_global(cx, |inline_assistant, cx| {
inline_assistant.register_workspace(&workspace, window, cx)
});
@@ -163,7 +163,7 @@ impl Render for ProfileSelector {
.unwrap_or_else(|| "Unknown".into());
if self.provider.profiles_supported(cx) {
- let this = cx.entity().clone();
+ let this = cx.entity();
let focus_handle = self.focus_handle.clone();
let trigger_button = Button::new("profile-selector-model", selected_profile)
.label_size(LabelSize::Small)
@@ -674,7 +674,7 @@ impl ChatPanel {
})
})
.when_some(message_id, |el, message_id| {
- let this = cx.entity().clone();
+ let this = cx.entity();
el.child(
self.render_popover_button(
@@ -95,7 +95,7 @@ pub fn init(cx: &mut App) {
.and_then(|room| room.read(cx).channel_id());
if let Some(channel_id) = channel_id {
- let workspace = cx.entity().clone();
+ let workspace = cx.entity();
window.defer(cx, move |window, cx| {
ChannelView::open(channel_id, None, workspace, window, cx)
.detach_and_log_err(cx)
@@ -1142,7 +1142,7 @@ impl CollabPanel {
window: &mut Window,
cx: &mut Context<Self>,
) {
- let this = cx.entity().clone();
+ let this = cx.entity();
if !(role == proto::ChannelRole::Guest
|| role == proto::ChannelRole::Talker
|| role == proto::ChannelRole::Member)
@@ -1272,7 +1272,7 @@ impl CollabPanel {
.channel_for_id(clipboard.channel_id)
.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| {
if self.has_subchannels(ix) {
@@ -1439,7 +1439,7 @@ impl CollabPanel {
window: &mut Window,
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 context_menu = ContextMenu::build(window, cx, |mut context_menu, _, _| {
@@ -586,7 +586,7 @@ impl ChannelModalDelegate {
return;
};
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 role = membership.role;
@@ -321,7 +321,7 @@ impl NotificationPanel {
.justify_end()
.child(Button::new("decline", "Decline").on_click({
let notification = notification.clone();
- let entity = cx.entity().clone();
+ let entity = cx.entity();
move |_, _, cx| {
entity.update(cx, |this, cx| {
this.respond_to_notification(
@@ -334,7 +334,7 @@ impl NotificationPanel {
}))
.child(Button::new("accept", "Accept").on_click({
let notification = notification.clone();
- let entity = cx.entity().clone();
+ let entity = cx.entity();
move |_, _, cx| {
entity.update(cx, |this, cx| {
this.respond_to_notification(
@@ -291,7 +291,7 @@ pub(crate) fn new_debugger_pane(
let Some(project) = project.upgrade() else {
return ControlFlow::Break(());
};
- let this_pane = cx.entity().clone();
+ let this_pane = cx.entity();
let item = if tab.pane == this_pane {
pane.item_for_index(tab.ix)
} else {
@@ -502,7 +502,7 @@ pub(crate) fn new_debugger_pane(
.on_drag(
DraggedTab {
item: item.boxed_clone(),
- pane: cx.entity().clone(),
+ pane: cx.entity(),
detail: 0,
is_active: selected,
ix,
@@ -127,7 +127,7 @@ impl Render for EditPredictionButton {
}),
);
}
- let this = cx.entity().clone();
+ let this = cx.entity();
div().child(
PopoverMenu::new("copilot")
@@ -182,7 +182,7 @@ impl Render for EditPredictionButton {
let icon = status.to_icon();
let tooltip_text = status.to_tooltip();
let has_menu = status.has_menu();
- let this = cx.entity().clone();
+ let this = cx.entity();
let fs = self.fs.clone();
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")
.menu(move |window, cx| {
@@ -74,7 +74,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let editor1 = cx.add_window({
let events = events.clone();
|window, cx| {
- let entity = cx.entity().clone();
+ let entity = cx.entity();
cx.subscribe_in(
&entity,
window,
@@ -95,7 +95,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let events = events.clone();
|window, cx| {
cx.subscribe_in(
- &cx.entity().clone(),
+ &cx.entity(),
window,
move |_, _, event: &EditorEvent, _, _| match event {
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);
let snapshot = editor.snapshot(window, cx);
- let _div = snapshot.render_crease_toggle(
- MultiBufferRow(1),
- false,
- cx.entity().clone(),
- window,
- cx,
- );
+ let _div =
+ snapshot.render_crease_toggle(MultiBufferRow(1), false, cx.entity(), window, cx);
snapshot
})
.unwrap();
@@ -7815,7 +7815,7 @@ impl Element for EditorElement {
min_lines,
max_lines,
} => {
- let editor_handle = cx.entity().clone();
+ let editor_handle = cx.entity();
let max_line_number_width =
self.max_line_number_width(&editor.snapshot(window, cx), window);
window.request_measured_layout(
@@ -703,7 +703,7 @@ impl ExtensionsPage {
extension: &ExtensionMetadata,
cx: &mut Context<Self>,
) -> ExtensionCard {
- let this = cx.entity().clone();
+ let this = cx.entity();
let status = Self::extension_status(&extension.id, cx);
let has_dev_extension = Self::dev_extension_exists(&extension.id, cx);
@@ -3410,7 +3410,7 @@ impl GitPanel {
* MAX_PANEL_EDITOR_LINES
+ gap;
- let git_panel = cx.entity().clone();
+ let git_panel = cx.entity();
let display_name = SharedString::from(Arc::from(
active_repository
.read(cx)
@@ -595,9 +595,7 @@ impl Render for TextInput {
.w_full()
.p(px(4.))
.bg(white())
- .child(TextElement {
- input: cx.entity().clone(),
- }),
+ .child(TextElement { input: cx.entity() }),
)
}
}
@@ -1358,7 +1358,7 @@ impl Render for LspLogToolbarItemView {
})
.collect();
- let log_toolbar_view = cx.entity().clone();
+ let log_toolbar_view = cx.entity();
let lsp_menu = PopoverMenu::new("LspLogView")
.anchor(Corner::TopLeft)
@@ -1007,7 +1007,7 @@ impl Render for LspTool {
(None, "All Servers Operational")
};
- let lsp_tool = cx.entity().clone();
+ let lsp_tool = cx.entity();
div().child(
PopoverMenu::new("lsp-tool")
@@ -456,7 +456,7 @@ impl SyntaxTreeToolbarItemView {
let active_layer = buffer_state.active_layer.clone()?;
let active_buffer = buffer_state.buffer.read(cx).snapshot();
- let view = cx.entity().clone();
+ let view = cx.entity();
Some(
PopoverMenu::new("Syntax Tree")
.trigger(Self::render_header(&active_layer))
@@ -4815,51 +4815,45 @@ impl OutlinePanel {
.when(show_indent_guides, |list| {
list.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
- .with_compute_indents_fn(
- cx.entity().clone(),
- |outline_panel, range, _, _| {
- let entries = outline_panel.cached_entries.get(range);
- if let Some(entries) = entries {
- entries.into_iter().map(|item| item.depth).collect()
- } else {
- smallvec::SmallVec::new()
- }
- },
- )
- .with_render_fn(
- cx.entity().clone(),
- move |outline_panel, params, _, _| {
- const LEFT_OFFSET: Pixels = px(14.);
-
- let indent_size = params.indent_size;
- let item_height = params.item_height;
- let active_indent_guide_ix = find_active_indent_guide_ix(
- outline_panel,
- ¶ms.indent_guides,
- );
+ .with_compute_indents_fn(cx.entity(), |outline_panel, range, _, _| {
+ let entries = outline_panel.cached_entries.get(range);
+ if let Some(entries) = entries {
+ entries.into_iter().map(|item| item.depth).collect()
+ } else {
+ smallvec::SmallVec::new()
+ }
+ })
+ .with_render_fn(cx.entity(), move |outline_panel, params, _, _| {
+ const LEFT_OFFSET: Pixels = px(14.);
+
+ let indent_size = params.indent_size;
+ let item_height = params.item_height;
+ let active_indent_guide_ix = find_active_indent_guide_ix(
+ outline_panel,
+ ¶ms.indent_guides,
+ );
- params
- .indent_guides
- .into_iter()
- .enumerate()
- .map(|(ix, layout)| {
- let bounds = Bounds::new(
- point(
- layout.offset.x * indent_size + LEFT_OFFSET,
- layout.offset.y * item_height,
- ),
- size(px(1.), layout.length * item_height),
- );
- ui::RenderedIndentGuide {
- bounds,
- layout,
- is_active: active_indent_guide_ix == Some(ix),
- hitbox: None,
- }
- })
- .collect()
- },
- ),
+ params
+ .indent_guides
+ .into_iter()
+ .enumerate()
+ .map(|(ix, layout)| {
+ let bounds = Bounds::new(
+ point(
+ layout.offset.x * indent_size + LEFT_OFFSET,
+ layout.offset.y * item_height,
+ ),
+ size(px(1.), layout.length * item_height),
+ );
+ ui::RenderedIndentGuide {
+ bounds,
+ layout,
+ is_active: active_indent_guide_ix == Some(ix),
+ hitbox: None,
+ }
+ })
+ .collect()
+ }),
)
})
};
@@ -5351,26 +5351,22 @@ impl Render for ProjectPanel {
.when(show_indent_guides, |list| {
list.with_decoration(
ui::indent_guides(px(indent_size), IndentGuideColors::panel(cx))
- .with_compute_indents_fn(
- cx.entity().clone(),
- |this, range, window, cx| {
- let mut items =
- SmallVec::with_capacity(range.end - range.start);
- this.iter_visible_entries(
- range,
- window,
- cx,
- |entry, _, entries, _, _| {
- let (depth, _) =
- Self::calculate_depth_and_difference(
- entry, entries,
- );
- items.push(depth);
- },
- );
- items
- },
- )
+ .with_compute_indents_fn(cx.entity(), |this, range, window, cx| {
+ let mut items =
+ SmallVec::with_capacity(range.end - range.start);
+ this.iter_visible_entries(
+ range,
+ window,
+ cx,
+ |entry, _, entries, _, _| {
+ let (depth, _) = Self::calculate_depth_and_difference(
+ entry, entries,
+ );
+ items.push(depth);
+ },
+ );
+ items
+ })
.on_click(cx.listener(
|this, active_indent_guide: &IndentGuideLayout, window, cx| {
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 PADDING_Y: Pixels = px(4.);
const HITBOX_OVERDRAW: Pixels = px(3.);
@@ -5447,7 +5443,7 @@ impl Render for ProjectPanel {
})
.when(show_sticky_entries, |list| {
let sticky_items = ui::sticky_items(
- cx.entity().clone(),
+ cx.entity(),
|this, range, window, cx| {
let mut items = SmallVec::with_capacity(range.end - range.start);
this.iter_visible_entries(
@@ -5474,7 +5470,7 @@ impl Render for ProjectPanel {
list.with_decoration(if show_indent_guides {
sticky_items.with_decoration(
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.);
let indent_size = params.indent_size;
@@ -1292,7 +1292,7 @@ impl RemoteServerProjects {
let connection_string = connection_string.clone();
move |_, _: &menu::Confirm, window, cx| {
remove_ssh_server(
- cx.entity().clone(),
+ cx.entity(),
server_index,
connection_string.clone(),
window,
@@ -1312,7 +1312,7 @@ impl RemoteServerProjects {
.child(Label::new("Remove Server").color(Color::Error))
.on_click(cx.listener(move |_, _, window, cx| {
remove_ssh_server(
- cx.entity().clone(),
+ cx.entity(),
server_index,
connection_string.clone(),
window,
@@ -244,7 +244,7 @@ impl Session {
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() {
KernelSpecification::Jupyter(kernel_specification)
@@ -65,7 +65,7 @@ impl Render for IndentGuidesStory {
},
)
.with_compute_indents_fn(
- cx.entity().clone(),
+ cx.entity(),
|this, range, _cx, _context| {
this.depths
.iter()
@@ -947,7 +947,7 @@ pub fn new_terminal_pane(
cx: &mut Context<TerminalPanel>,
) -> Entity<Pane> {
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 mut pane = Pane::new(
workspace.clone(),
@@ -1009,7 +1009,7 @@ pub fn new_terminal_pane(
return ControlFlow::Break(());
};
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 {
pane.item_for_index(tab.ix)
} else {
@@ -1491,7 +1491,7 @@ impl TerminalView {
impl Render for TerminalView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
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);
@@ -20,7 +20,7 @@ impl ModeIndicator {
})
.detach();
- let handle = cx.entity().clone();
+ let handle = cx.entity();
let window_handle = window.window_handle();
cx.observe_new::<Vim>(move |_, window, cx| {
let Some(window) = window else {
@@ -29,7 +29,7 @@ impl ModeIndicator {
if window.window_handle() != window_handle {
return;
}
- let vim = cx.entity().clone();
+ let vim = cx.entity();
handle.update(cx, |_, cx| {
cx.subscribe(&vim, |mode_indicator, vim, event, cx| match event {
VimEvent::Focused => {
@@ -332,7 +332,7 @@ impl Vim {
Vim::take_forced_motion(cx);
let prior_selections = self.editor_selections(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| {
self.search.direction = direction;
@@ -402,7 +402,7 @@ impl Vim {
const NAMESPACE: &'static str = "vim";
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;
if initial_mode == Mode::Normal && HelixModeSetting::get_global(cx).0 {
@@ -253,7 +253,7 @@ impl Dock {
cx: &mut Context<Workspace>,
) -> Entity<Self> {
let focus_handle = cx.focus_handle();
- let workspace = cx.entity().clone();
+ let workspace = cx.entity();
let dock = cx.new(|cx| {
let focus_subscription =
cx.on_focus(&focus_handle, window, |dock: &mut Dock, window, cx| {
@@ -346,7 +346,7 @@ impl Render for LanguageServerPrompt {
)
.child(Label::new(request.message.to_string()).size(LabelSize::Small))
.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())
.size(ButtonSize::Large)
.on_click(move |_, window, cx| {
@@ -2198,7 +2198,7 @@ impl Pane {
fn update_status_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let workspace = self.workspace.clone();
- let pane = cx.entity().clone();
+ let pane = cx.entity();
window.defer(cx, move |window, cx| {
let Ok(status_bar) =
@@ -2279,7 +2279,7 @@ impl Pane {
cx: &mut Context<Self>,
) {
maybe!({
- let pane = cx.entity().clone();
+ let pane = cx.entity();
let destination_index = match operation {
PinOperation::Pin => self.pinned_tab_count.min(ix),
@@ -2473,7 +2473,7 @@ impl Pane {
.on_drag(
DraggedTab {
item: item.boxed_clone(),
- pane: cx.entity().clone(),
+ pane: cx.entity(),
detail,
is_active,
ix,
@@ -2832,7 +2832,7 @@ impl Pane {
let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft)
.icon_size(IconSize::Small)
.on_click({
- let entity = cx.entity().clone();
+ let entity = cx.entity();
move |_, 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)
.icon_size(IconSize::Small)
.on_click({
- let entity = cx.entity().clone();
+ let entity = cx.entity();
move |_, window, cx| entity.update(cx, |pane, cx| pane.navigate_forward(window, cx))
})
.disabled(!self.can_navigate_forward())
@@ -3054,7 +3054,7 @@ impl Pane {
return;
}
}
- let mut to_pane = cx.entity().clone();
+ let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction;
let item_id = dragged_tab.item.item_id();
if let Some(preview_item_id) = self.preview_item_id {
@@ -3163,7 +3163,7 @@ impl Pane {
return;
}
}
- let mut to_pane = cx.entity().clone();
+ let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction;
let project_entry_id = *project_entry_id;
self.workspace
@@ -3239,7 +3239,7 @@ impl Pane {
return;
}
}
- let mut to_pane = cx.entity().clone();
+ let mut to_pane = cx.entity();
let mut split_direction = self.drag_split_direction;
let paths = paths.paths().to_vec();
let is_remote = self
@@ -6338,7 +6338,7 @@ impl Render for Workspace {
.border_b_1()
.border_color(colors.border)
.child({
- let this = cx.entity().clone();
+ let this = cx.entity();
canvas(
move |bounds, window, cx| {
this.update(cx, |this, cx| {
@@ -319,7 +319,7 @@ pub fn initialize_workspace(
return;
};
- let workspace_handle = cx.entity().clone();
+ let workspace_handle = cx.entity();
let center_pane = workspace.active_pane().clone();
initialize_pane(workspace, ¢er_pane, window, cx);