[ast] Refactor lazy_static to LazyLock
It is available in Rust 1.80 and reduces a dependency.
This commit is contained in:
parent
202a902cd0
commit
c3927d0ef6
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -634,7 +634,6 @@ name = "nac3ast"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"lazy_static",
|
||||
"parking_lot",
|
||||
"string-interner",
|
||||
]
|
||||
|
@ -10,7 +10,6 @@ constant-optimization = ["fold"]
|
||||
fold = []
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "1.5"
|
||||
parking_lot = "0.12"
|
||||
string-interner = "0.17"
|
||||
fxhash = "0.2"
|
||||
|
@ -5,14 +5,12 @@ pub use crate::location::Location;
|
||||
|
||||
use fxhash::FxBuildHasher;
|
||||
use parking_lot::{Mutex, MutexGuard};
|
||||
use std::{cell::RefCell, collections::HashMap, fmt};
|
||||
use std::{cell::RefCell, collections::HashMap, fmt, sync::LazyLock};
|
||||
use string_interner::{symbol::SymbolU32, DefaultBackend, StringInterner};
|
||||
|
||||
pub type Interner = StringInterner<DefaultBackend, FxBuildHasher>;
|
||||
lazy_static! {
|
||||
static ref INTERNER: Mutex<Interner> =
|
||||
Mutex::new(StringInterner::with_hasher(FxBuildHasher::default()));
|
||||
}
|
||||
static INTERNER: LazyLock<Mutex<Interner>> =
|
||||
LazyLock::new(|| Mutex::new(StringInterner::with_hasher(FxBuildHasher::default())));
|
||||
|
||||
thread_local! {
|
||||
static LOCAL_INTERNER: RefCell<HashMap<String, StrRef>> = RefCell::default();
|
||||
|
@ -14,9 +14,6 @@
|
||||
clippy::wildcard_imports
|
||||
)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
mod ast_gen;
|
||||
mod constant;
|
||||
#[cfg(feature = "fold")]
|
||||
|
Loading…
Reference in New Issue
Block a user