chore: replace once_cell OnceCell/Lazy with std OnceLock/LazyLock (#3709)

This commit is contained in:
Paolo Barbolini
2025-06-18 01:38:02 +02:00
committed by GitHub
parent df47ffedd2
commit 764ae2f702
15 changed files with 44 additions and 41 deletions

View File

@@ -24,7 +24,6 @@ validator = { version = "0.16.0", features = ["derive"] }
# Auxilliary crates
anyhow = "1.0.58"
dotenvy = "0.15.1"
once_cell = "1.13.0"
thiserror = "2.0.0"
tracing = "0.1.35"

View File

@@ -1,9 +1,8 @@
use axum::http::StatusCode;
use axum::{routing::post, Extension, Json, Router};
use once_cell::sync::Lazy;
use rand::Rng;
use regex::Regex;
use std::time::Duration;
use std::{sync::LazyLock, time::Duration};
use serde::Deserialize;
use sqlx::{PgExecutor, PgPool};
@@ -18,7 +17,7 @@ pub fn router() -> Router {
Router::new().route("/v1/user", post(create_user))
}
static USERNAME_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[0-9A-Za-z_]+$").unwrap());
static USERNAME_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^[0-9A-Za-z_]+$").unwrap());
// CREATE USER