mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2025-06-06 07:29:01 +00:00
Remove once_cell
This commit is contained in:
parent
25316873d5
commit
9a7c584434
3 changed files with 3 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3349,7 +3349,6 @@ dependencies = [
|
|||
"config",
|
||||
"fake",
|
||||
"log",
|
||||
"once_cell",
|
||||
"quickcheck",
|
||||
"quickcheck_macros",
|
||||
"reqwest",
|
||||
|
|
|
@ -50,4 +50,3 @@ wiremock = "0.6"
|
|||
serde_json = "1.0.61"
|
||||
claims = "0.7"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
once_cell = "1.7.2"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use sqlx::{Connection, Executor, PgConnection, PgPool};
|
||||
use std::net::TcpListener;
|
||||
use std::sync::LazyLock;
|
||||
use uuid::Uuid;
|
||||
use zero2prod::configuration::{get_configuration, DatabaseSettings};
|
||||
use zero2prod::email_client::EmailClient;
|
||||
|
@ -8,7 +8,7 @@ use zero2prod::startup::run;
|
|||
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() {
|
||||
|
@ -28,7 +28,7 @@ pub struct TestApp {
|
|||
async fn spawn_app() -> TestApp {
|
||||
// The first time `initialize` is invoked the code in `TRACING` is executed.
|
||||
// All other invocations will instead skip execution.
|
||||
Lazy::force(&TRACING);
|
||||
LazyLock::force(&TRACING);
|
||||
|
||||
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
||||
// We retrieve the port assigned to us by the OS
|
||||
|
|
Loading…
Reference in a new issue