Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Avoid double borrow of view in ProjectPanel drag and drop
Antonio Scandurraf12746c4b744
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex 094e1ce0ba0..c70ffdd4e18 100644--- a/crates/project_panel/src/project_panel.rs+++ b/crates/project_panel/src/project_panel.rs@@ -1156,7 +1156,6 @@ impl ProjectPanel {theme: &theme::ProjectPanel,cx: &mut ViewContext<Self>,) -> Element<Self> {- let this = cx.handle().downgrade();let kind = details.kind;let path = details.path.clone();let padding = theme.container.padding.left + details.depth as f32 * theme.indent_width;@@ -1231,21 +1230,17 @@ impl ProjectPanel {});}})- .on_move(move |_, _, cx| {+ .on_move(move |_, this, cx| {if cx.global::<DragAndDrop<Workspace>>().currently_dragged::<ProjectEntryId>(cx.window_id()).is_some(){- if let Some(this) = this.upgrade(cx) {- this.update(cx, |this, _| {- this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {- path.parent().map(|parent| Arc::from(parent))- } else {- Some(path.clone())- };- })- }+ this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {+ path.parent().map(|parent| Arc::from(parent))+ } else {+ Some(path.clone())+ };}}).as_draggable(entry_id, {