Use into_any instead of weird 'as' hack

This commit is contained in:
Nathan Sobo 2023-04-02 15:55:30 -06:00
parent 27258a0889
commit 71cf6ec5ae

View File

@ -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,