summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAbdul-Rahman Sibahi <asibahi@users.noreply.github.com>2024-10-31 14:52:11 +0300
committerGitHub <noreply@github.com>2024-10-31 11:52:11 +0000
commitb969c01b282287b44c3e131f8c0c53dcbb304e30 (patch)
treefe58484bfa76e7fe7a35bf0bffdc339b24621693 /docs
parent644ed252dda1a0785d2bee577a89322416f4d950 (diff)
Replace `once_cell`'s `Lazy` as much as possible (#4617)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/Cargo.toml1
-rw-r--r--docs/src/lib.rs8
2 files changed, 4 insertions, 5 deletions
diff --git a/docs/Cargo.toml b/docs/Cargo.toml
index a24ee254..41a5645e 100644
--- a/docs/Cargo.toml
+++ b/docs/Cargo.toml
@@ -22,7 +22,6 @@ typst-dev-assets = { workspace = true }
clap = { workspace = true, optional = true }
ecow = { workspace = true }
heck = { workspace = true }
-once_cell = { workspace = true }
pulldown-cmark = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true, optional = true }
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<Vec<GroupData>> = Lazy::new(|| {
+static GROUPS: LazyLock<Vec<GroupData>> = LazyLock::new(|| {
let mut groups: Vec<GroupData> =
yaml::from_str(load!("reference/groups.yml")).unwrap();
for group in &mut groups {
@@ -54,7 +54,7 @@ static GROUPS: Lazy<Vec<GroupData>> = Lazy::new(|| {
groups
});
-static LIBRARY: Lazy<LazyHash<Library>> = Lazy::new(|| {
+static LIBRARY: LazyLock<LazyHash<Library>> = LazyLock::new(|| {
let mut lib = Library::default();
let scope = lib.global.scope_mut();
@@ -74,7 +74,7 @@ static LIBRARY: Lazy<LazyHash<Library>> = Lazy::new(|| {
LazyHash::new(lib)
});
-static FONTS: Lazy<(LazyHash<FontBook>, Vec<Font>)> = Lazy::new(|| {
+static FONTS: LazyLock<(LazyHash<FontBook>, Vec<Font>)> = LazyLock::new(|| {
let fonts: Vec<_> = typst_assets::fonts()
.chain(typst_dev_assets::fonts())
.flat_map(|data| Font::iter(Bytes::from_static(data)))