From b969c01b282287b44c3e131f8c0c53dcbb304e30 Mon Sep 17 00:00:00 2001 From: Abdul-Rahman Sibahi Date: Thu, 31 Oct 2024 14:52:11 +0300 Subject: Replace `once_cell`'s `Lazy` as much as possible (#4617) Co-authored-by: Laurenz --- crates/typst-syntax/src/file.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/typst-syntax/src') 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> = - Lazy::new(|| RwLock::new(Interner { to_id: HashMap::new(), from_id: Vec::new() })); +static INTERNER: LazyLock> = LazyLock::new(|| { + RwLock::new(Interner { to_id: HashMap::new(), from_id: Vec::new() }) +}); /// A package-path interner. struct Interner { -- cgit v1.2.3