Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Use into_any instead of weird 'as' hack

Nathan Sobo71cf6ec5ae94
diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs
index 2c8c9aadbe2..76004f14a4d 100644
--- a/crates/client/src/client.rs
+++ b/crates/client/src/client.rs
@@ -457,10 +457,10 @@ impl Client {
cx: &mut ViewContext<T>,
) -> Subscription {
let id = (TypeId::of::<T>(), remote_id);
- self.state.write().entities_by_type_and_remote_id.insert(
- id,
- WeakSubscriber::View((&cx.weak_handle() as &AnyWeakViewHandle).clone()),
- );
+ self.state
+ .write()
+ .entities_by_type_and_remote_id
+ .insert(id, WeakSubscriber::View(cx.weak_handle().into_any()));
Subscription::Entity {
client: Arc::downgrade(self),
id,