chore: Replace as_any functions with trait upcasting (#28221)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-04-08 22:16:27 +02:00 committed by GitHub
parent 38ec45008c
commit 0b75c13034
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 23 additions and 87 deletions

View file

@ -10,7 +10,7 @@ use proto::{
error::ErrorExt as _,
};
use std::{
any::TypeId,
any::{Any, TypeId},
sync::{Arc, Weak},
};
@ -250,8 +250,7 @@ impl AnyProtoClient {
let message_type_id = TypeId::of::<M>();
let entity_type_id = TypeId::of::<E>();
let entity_id_extractor = |envelope: &dyn AnyTypedEnvelope| {
envelope
.as_any()
(envelope as &dyn Any)
.downcast_ref::<TypedEnvelope<M>>()
.unwrap()
.payload
@ -296,8 +295,7 @@ impl AnyProtoClient {
let message_type_id = TypeId::of::<M>();
let entity_type_id = TypeId::of::<E>();
let entity_id_extractor = |envelope: &dyn AnyTypedEnvelope| {
envelope
.as_any()
(envelope as &dyn Any)
.downcast_ref::<TypedEnvelope<M>>()
.unwrap()
.payload