From aae796327aa74c93ac9e83b2e302af7e0be3f966 Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:12:38 +0200 Subject: [PATCH] Remove once_cell --- Cargo.lock | 1 - Cargo.toml | 1 - tests/api/helpers.rs | 6 +++--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f621c1e..5f0d0bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3690,7 +3690,6 @@ dependencies = [ "fake", "linkify", "log", - "once_cell", "quickcheck", "quickcheck_macros", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index 6e7a182..6daa2d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,4 +61,3 @@ serde_urlencoded = "0.7.1" linkify = "0.10" claims = "0.7" reqwest = { version = "0.12", features = ["json"] } -once_cell = "1.7.2" diff --git a/tests/api/helpers.rs b/tests/api/helpers.rs index 25ef7be..d1f19ec 100644 --- a/tests/api/helpers.rs +++ b/tests/api/helpers.rs @@ -1,7 +1,7 @@ use argon2::password_hash::SaltString; use argon2::{Algorithm, Argon2, Params, PasswordHasher, Version}; -use once_cell::sync::Lazy; use sqlx::{Connection, Executor, PgConnection, PgPool}; +use std::sync::LazyLock; use uuid::Uuid; use wiremock::MockServer; use zero2prod::configuration::{get_configuration, DatabaseSettings}; @@ -11,7 +11,7 @@ use zero2prod::startup::{get_connection_pool, Application}; use zero2prod::telemetry::{get_subscriber, init_subscriber}; // Ensure that the `tracing` stack is only initialised once using `once_cell` -static TRACING: Lazy<()> = Lazy::new(|| { +static TRACING: LazyLock<()> = LazyLock::new(|| { let default_filter_level = "info".to_string(); let subscriber_name = "test".to_string(); if std::env::var("TEST_LOG").is_ok() { @@ -179,7 +179,7 @@ impl TestApp { } pub async fn spawn_app() -> TestApp { - Lazy::force(&TRACING); + LazyLock::force(&TRACING); // Launch a mock server to stand in for Postmark's API let email_server = MockServer::start().await;