mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-27 11:31:11 +00:00
Remove once_cell
This commit is contained in:
parent
c6921090b2
commit
d7b06d1ad3
3 changed files with 3 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3054,7 +3054,6 @@ dependencies = [
|
|||
"claims",
|
||||
"config",
|
||||
"log",
|
||||
"once_cell",
|
||||
"reqwest",
|
||||
"secrecy",
|
||||
"serde",
|
||||
|
|
|
@ -40,4 +40,3 @@ secrecy = { version = "0.8", features = ["serde"] }
|
|||
[dev-dependencies]
|
||||
claims = "0.7"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
once_cell = "1.7.2"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
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::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() {
|
||||
|
@ -27,7 +27,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