refactor: remove as_any function from Aspect since trait upcasting added
This commit is contained in:
@@ -281,9 +281,6 @@ fn generate_aspect(aspect: &Aspect) -> TokenStream {
|
||||
}
|
||||
macro_rules! #aspect_macro_name {
|
||||
() => {
|
||||
fn as_any(self: Arc<Self>) -> Arc<dyn std::any::Any + Send + Sync + 'static> {
|
||||
self
|
||||
}
|
||||
#[allow(clippy::all)]
|
||||
fn run_signal(
|
||||
&self,
|
||||
|
||||
@@ -71,9 +71,6 @@ impl AspectIdentifier for Alias {
|
||||
const ID: u64 = 0;
|
||||
}
|
||||
impl Aspect for Alias {
|
||||
fn as_any(self: Arc<Self>) -> Arc<dyn std::any::Any + Send + Sync + 'static> {
|
||||
self
|
||||
}
|
||||
fn run_signal(
|
||||
&self,
|
||||
_calling_client: Arc<Client>,
|
||||
|
||||
@@ -303,7 +303,6 @@ pub trait AspectIdentifier: Aspect {
|
||||
const ID: u64;
|
||||
}
|
||||
pub trait Aspect: Any + Send + Sync + 'static {
|
||||
fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync + 'static>;
|
||||
fn run_signal(
|
||||
&self,
|
||||
calling_client: Arc<Client>,
|
||||
@@ -337,7 +336,6 @@ impl Aspects {
|
||||
.get(&A::ID)
|
||||
// .cloned doesn't work for some reason
|
||||
.map(|v| v.clone())
|
||||
.map(|a| a.as_any())
|
||||
.and_then(|a| Arc::downcast(a).ok())
|
||||
.ok_or(ServerError::NoAspect(TypeId::of::<A>()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user