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:
parent
7199c733b2
commit
3e0a755486
32 changed files with 106 additions and 123 deletions
|
@ -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| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue