From 1a51ebcd446d77ec5d553a67a654c33915155e4c Mon Sep 17 00:00:00 2001 From: wrk Date: Tue, 30 May 2023 21:52:54 +0200 Subject: [PATCH] Fixing unused lifetimes --- src/lib.rs | 16 ++++++++-------- src/system.rs | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c927eb2..16c65fc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -266,20 +266,20 @@ impl Context { } } - pub fn add_system System<'a> + Send + Sync + 'static>( + pub fn add_system System + Send + Sync + 'static>( &mut self, name: &str, - system: impl for<'a> IntoSystem<'a, I, System = S>, + system: impl for<'a> IntoSystem, ) -> &mut Self { self.systems .insert(name.to_owned(), Box::new(system.into_system())); self } - pub fn add_interval_task System<'a> + Send + Sync + 'static>( + pub fn add_interval_task System + Send + Sync + 'static>( &mut self, duration: Duration, - system_task: impl for<'a> IntoSystem<'a, I, System = S>, + system_task: impl for<'a> IntoSystem, ) -> &mut Self { self.interval_tasks .push((duration, Box::new(system_task.into_system()))); @@ -361,10 +361,10 @@ impl Irc { }) } - pub async fn add_system System<'a> + Send + Sync + 'static>( + pub async fn add_system System + Send + Sync + 'static>( &mut self, name: &str, - system: impl for<'a> IntoSystem<'a, I, System = S>, + system: impl for<'a> IntoSystem, ) -> &mut Self { { let mut context = self.context.write().await; @@ -373,10 +373,10 @@ impl Irc { self } - pub async fn add_interval_task System<'a> + Send + Sync + 'static>( + pub async fn add_interval_task System + Send + Sync + 'static>( &mut self, duration: Duration, - system: impl for<'a> IntoSystem<'a, I, System = S>, + system: impl for<'a> IntoSystem, ) -> &mut Self { { let mut context = self.context.write().await; diff --git a/src/system.rs b/src/system.rs index 814280d..f7d0e2d 100644 --- a/src/system.rs +++ b/src/system.rs @@ -7,12 +7,12 @@ pub struct FunctionSystem { marker: PhantomData Input>, } -pub trait System<'a> { - fn run(&mut self, prefix: &'a IrcPrefix, factory: &'a mut Factory) -> Response; +pub trait System { + fn run(&mut self, prefix: &IrcPrefix, factory: &mut Factory) -> Response; } -pub trait IntoSystem<'a, Input> { - type System: System<'a>; +pub trait IntoSystem { + type System: System; fn into_system(self) -> Self::System; } @@ -23,7 +23,7 @@ macro_rules! impl_system { ) => { #[allow(non_snake_case)] #[allow(unused)] - impl System<'_> for FunctionSystem<($($params,)*), F> + impl System for FunctionSystem<($($params,)*), F> where for<'a, 'b> &'a mut F: FnMut( $($params),* ) -> R + @@ -51,7 +51,7 @@ macro_rules! impl_into_system { ( $($params:ident),* ) => { - impl IntoSystem<'_, ($($params,)*)> for F + impl IntoSystem<($($params,)*)> for F where for<'a, 'b> &'a mut F: FnMut( $($params),* ) -> R + @@ -81,7 +81,7 @@ impl_into_system!(T1, T2); impl_into_system!(T1, T2, T3); impl_into_system!(T1, T2, T3, T4); -pub(crate) type StoredSystem = Box System<'a> + Send + Sync>; +pub(crate) type StoredSystem = Box System + Send + Sync>; pub(crate) trait SystemParam { type Item<'new>;