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 --- docs/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/src/lib.rs') diff --git a/docs/src/lib.rs b/docs/src/lib.rs index 59fc1cbf..bc9b53c9 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -12,9 +12,9 @@ pub use self::model::*; use std::collections::HashSet; use ecow::{eco_format, EcoString}; -use once_cell::sync::Lazy; use serde::Deserialize; use serde_yaml as yaml; +use std::sync::LazyLock; use typst::diag::{bail, StrResult}; use typst::foundations::{ AutoValue, Bytes, CastInfo, Category, Func, Module, NoneValue, ParamInfo, Repr, @@ -37,7 +37,7 @@ macro_rules! load { }; } -static GROUPS: Lazy> = Lazy::new(|| { +static GROUPS: LazyLock> = LazyLock::new(|| { let mut groups: Vec = yaml::from_str(load!("reference/groups.yml")).unwrap(); for group in &mut groups { @@ -54,7 +54,7 @@ static GROUPS: Lazy> = Lazy::new(|| { groups }); -static LIBRARY: Lazy> = Lazy::new(|| { +static LIBRARY: LazyLock> = LazyLock::new(|| { let mut lib = Library::default(); let scope = lib.global.scope_mut(); @@ -74,7 +74,7 @@ static LIBRARY: Lazy> = Lazy::new(|| { LazyHash::new(lib) }); -static FONTS: Lazy<(LazyHash, Vec)> = Lazy::new(|| { +static FONTS: LazyLock<(LazyHash, Vec)> = LazyLock::new(|| { let fonts: Vec<_> = typst_assets::fonts() .chain(typst_dev_assets::fonts()) .flat_map(|data| Font::iter(Bytes::from_static(data))) -- cgit v1.2.3