Replace lazy_static with once_cell

This commit is contained in:
Jonas Platte 2019-10-31 22:55:24 +01:00
parent 31b683ab69
commit f994672db5
2 changed files with 4 additions and 6 deletions

View File

@ -14,7 +14,7 @@ edition = "2018"
[dependencies]
diesel = { version = "1.4.3", optional = true }
lazy_static = "1.4.0"
once_cell = "1.2.0"
rand = "0.7.2"
regex = "1.3.1"
serde = "1.0.102"

View File

@ -7,7 +7,7 @@ use std::{
#[cfg(feature = "diesel")]
use diesel::sql_types::Text;
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{
de::{Error as SerdeError, Unexpected, Visitor},
@ -17,10 +17,8 @@ use url::Host;
use crate::{display, error::Error, generate_localpart, parse_id};
lazy_static! {
static ref USER_LOCALPART_PATTERN: Regex =
Regex::new(r"\A[a-z0-9._=-]+\z").expect("Failed to create user localpart regex.");
}
static USER_LOCALPART_PATTERN: Lazy<Regex> =
Lazy::new(|| Regex::new(r"\A[a-z0-9._=-]+\z").expect("Failed to create user localpart regex."));
/// A Matrix user ID.
///