diff --git a/crates/api_common/src/context.rs b/crates/api_common/src/context.rs index 77d430b20..334983b20 100644 --- a/crates/api_common/src/context.rs +++ b/crates/api_common/src/context.rs @@ -70,7 +70,8 @@ impl LemmyContext { let rate_limit_cell = RateLimitCell::with_test_config(); let context = LemmyContext::create(pool, client, secret, rate_limit_cell.clone()); - let config = FederationConfig::builder() + + FederationConfig::builder() .domain(context.settings().hostname.clone()) .app_data(context) .debug(true) @@ -78,8 +79,7 @@ impl LemmyContext { .http_fetch_limit(0) .build() .await - .expect("build federation config"); - return config; + .expect("build federation config") } pub async fn init_test_context() -> Data { let config = Self::init_test_federation_config().await; diff --git a/crates/federate/Cargo.toml b/crates/federate/Cargo.toml index 59c241e9c..8d98938a8 100644 --- a/crates/federate/Cargo.toml +++ b/crates/federate/Cargo.toml @@ -41,4 +41,4 @@ url.workspace = true actix-web.workspace = true tracing-test = "0.2.5" uuid.workspace = true -test-context = "0.3.0" \ No newline at end of file +test-context = "0.3.0" diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 6d06768bc..d52ca2ce3 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -422,10 +422,8 @@ mod test { use std::{fs::File, io::BufReader}; use test_context::{test_context, AsyncTestContext}; use tokio::{ - select, spawn, sync::mpsc::{error::TryRecvError, unbounded_channel, UnboundedReceiver}, - task::JoinHandle, }; use tracing_test::traced_test; use url::Url; @@ -462,8 +460,7 @@ mod test { let (inbox_sender, inbox_receiver) = unbounded_channel(); // listen for received activities in background - let cancel_ = cancel.clone(); - let wait_stop_server = listen_activities(inbox_sender, cancel_)?; + let wait_stop_server = listen_activities(inbox_sender)?; let fed_config = FederationWorkerConfig { concurrent_sends_per_instance: 1, @@ -578,10 +575,7 @@ mod test { Ok(()) } - fn listen_activities( - inbox_sender: UnboundedSender, - cancel: CancellationToken, - ) -> LemmyResult { + fn listen_activities(inbox_sender: UnboundedSender) -> LemmyResult { let run = HttpServer::new(move || { App::new() .app_data(actix_web::web::Data::new(inbox_sender.clone())) @@ -616,7 +610,7 @@ mod test { let form = SentActivityForm { ap_id: Url::parse(&format!( "http://local.com/activity/{}", - uuid::Uuid::new_v4().to_string() + uuid::Uuid::new_v4() ))? .into(), data: serde_json::from_reader(reader)?,