diff options
| author | Abdul-Rahman Sibahi <asibahi@users.noreply.github.com> | 2024-10-31 14:52:11 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 11:52:11 +0000 |
| commit | b969c01b282287b44c3e131f8c0c53dcbb304e30 (patch) | |
| tree | fe58484bfa76e7fe7a35bf0bffdc339b24621693 /crates/typst-syntax/src | |
| parent | 644ed252dda1a0785d2bee577a89322416f4d950 (diff) | |
Replace `once_cell`'s `Lazy` as much as possible (#4617)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-syntax/src')
| -rw-r--r-- | crates/typst-syntax/src/file.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/typst-syntax/src/file.rs b/crates/typst-syntax/src/file.rs index bc7dd314..e24fc8fb 100644 --- a/crates/typst-syntax/src/file.rs +++ b/crates/typst-syntax/src/file.rs @@ -2,16 +2,15 @@ use std::collections::HashMap; use std::fmt::{self, Debug, Formatter}; -use std::sync::RwLock; - -use once_cell::sync::Lazy; +use std::sync::{LazyLock, RwLock}; use crate::package::PackageSpec; use crate::VirtualPath; /// The global package-path interner. -static INTERNER: Lazy<RwLock<Interner>> = - Lazy::new(|| RwLock::new(Interner { to_id: HashMap::new(), from_id: Vec::new() })); +static INTERNER: LazyLock<RwLock<Interner>> = LazyLock::new(|| { + RwLock::new(Interner { to_id: HashMap::new(), from_id: Vec::new() }) +}); /// A package-path interner. struct Interner { |
