From 832bdf6e9221790fc7a07ed0dbe818e10a577140 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Thu, 7 Sep 2023 19:06:39 +0200 Subject: [PATCH] Simplify lifetimes I think I may have overdone it with lifetime-per-dependency, I doubt that'll ever become necessary --- src/processes/post_saver.rs | 12 ++++++------ src/processes/profile_classifier.rs | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/processes/post_saver.rs b/src/processes/post_saver.rs index 955a007..4576d0d 100644 --- a/src/processes/post_saver.rs +++ b/src/processes/post_saver.rs @@ -4,25 +4,25 @@ use async_trait::async_trait; use crate::services::bluesky::{Bluesky, Operation, OperationProcessor}; use crate::services::database::Database; -pub struct PostSaver<'a, 'b> { +pub struct PostSaver<'a> { database: &'a Database, - bluesky: &'b Bluesky, + bluesky: &'a Bluesky, } -impl<'a, 'b> PostSaver<'a, 'b> { - pub fn new(database: &'a Database, bluesky: &'b Bluesky) -> Self { +impl<'a> PostSaver<'a> { + pub fn new(database: &'a Database, bluesky: &'a Bluesky) -> Self { Self { database, bluesky } } } -impl<'a, 'b> PostSaver<'a, 'b> { +impl<'a> PostSaver<'a> { pub async fn start(&self) -> Result<()> { Ok(self.bluesky.subscribe_to_operations(self).await?) } } #[async_trait] -impl<'a, 'b> OperationProcessor for PostSaver<'a, 'b> { +impl<'a> OperationProcessor for PostSaver<'a> { async fn process_operation(&self, operation: &Operation) -> Result<()> { match operation { Operation::CreatePost { diff --git a/src/processes/profile_classifier.rs b/src/processes/profile_classifier.rs index ec95766..9c4d5bb 100644 --- a/src/processes/profile_classifier.rs +++ b/src/processes/profile_classifier.rs @@ -6,14 +6,14 @@ use crate::services::ai::AI; use crate::services::bluesky::Bluesky; use crate::services::database::Database; -pub struct ProfileClassifier<'a, 'b, 'c> { +pub struct ProfileClassifier<'a> { database: &'a Database, - ai: &'b AI, - bluesky: &'c Bluesky, + ai: &'a AI, + bluesky: &'a Bluesky, } -impl<'a, 'b, 'c> ProfileClassifier<'a, 'b, 'c> { - pub fn new(database: &'a Database, ai: &'b AI, bluesky: &'c Bluesky) -> Self { +impl<'a> ProfileClassifier<'a> { + pub fn new(database: &'a Database, ai: &'a AI, bluesky: &'a Bluesky) -> Self { Self { database, ai,