Don't capture `Workspace` handle in `defer` when rendering `Dock`

Antonio Scandurra created

GPUI already provides a mutable reference to the `Workspace` in the
`defer` callback.

Change summary

crates/workspace/src/dock.rs | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

Detailed changes

crates/workspace/src/dock.rs 🔗

@@ -362,13 +362,8 @@ impl Dock {
                         );
 
                     let size = resizable.current_size();
-                    let workspace = cx.handle().downgrade();
-                    cx.defer(move |_, cx| {
-                        if let Some(workspace) = workspace.upgrade(cx) {
-                            workspace.update(cx, |workspace, _| {
-                                workspace.dock.panel_sizes.insert(anchor, size);
-                            })
-                        }
+                    cx.defer(move |workspace, _| {
+                        workspace.dock.panel_sizes.insert(anchor, size);
                     });
 
                     if anchor == DockAnchor::Right {