From b77c4441112aac6db7e53f0aea9728a66f229f28 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Fri, 13 Mar 2026 13:12:42 +0100 Subject: [PATCH] editor: Remove unnecessary clone (#51470) Release Notes: - N/A --- crates/editor/src/hover_popover.rs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs index ad54d6105ca3896d21857d548d80f991a1a76ecc..99069cac6ceeec3983d6713777007876c74c8d19 100644 --- a/crates/editor/src/hover_popover.rs +++ b/crates/editor/src/hover_popover.rs @@ -8,10 +8,10 @@ use crate::{ }; use anyhow::Context as _; use gpui::{ - AnyElement, App, AsyncApp, AsyncWindowContext, Bounds, Context, Entity, Focusable as _, - FontWeight, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, - ScrollHandle, Size, StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task, - TextStyleRefinement, WeakEntity, Window, canvas, div, px, + AnyElement, App, AsyncWindowContext, Bounds, Context, Entity, Focusable as _, FontWeight, Hsla, + InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, ScrollHandle, Size, + StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task, TextStyleRefinement, + Window, canvas, div, px, }; use itertools::Itertools; use language::{DiagnosticEntry, Language, LanguageRegistry}; @@ -73,18 +73,13 @@ pub fn hover_at( } // If we are moving closer, or if no timer is running at all, start/restart the 300ms timer. - let delay = 300u64; - let task = cx.spawn(move |this: WeakEntity, cx: &mut AsyncApp| { - let mut cx = cx.clone(); - async move { - cx.background_executor() - .timer(Duration::from_millis(delay)) - .await; - this.update(&mut cx, |editor, cx| { - hide_hover(editor, cx); - }) - .ok(); - } + let delay = Duration::from_millis(300u64); + let task = cx.spawn(async move |this, cx| { + cx.background_executor().timer(delay).await; + this.update(cx, |editor, cx| { + hide_hover(editor, cx); + }) + .ok(); }); editor.hover_state.hiding_delay_task = Some(task); }