feat: remove lazy_static in favor of LazyLock

This switches to the built-in `std::sync::LazyLock`
This commit is contained in:
Yuri Astrakhan 2025-01-20 19:44:59 -05:00 committed by Amaan Qureshi
parent f23a52f410
commit 48059b72a8
20 changed files with 234 additions and 215 deletions

View file

@ -5,13 +5,12 @@ use std::{
io::{self, Write as _},
path::{self, Path, PathBuf},
str,
sync::{atomic::AtomicUsize, Arc},
sync::{atomic::AtomicUsize, Arc, LazyLock},
time::Instant,
};
use anstyle::{Ansi256Color, AnsiColor, Color, Effects, RgbColor};
use anyhow::Result;
use lazy_static::lazy_static;
use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{json, Value};
use tree_sitter_highlight::{HighlightConfiguration, HighlightEvent, Highlighter, HtmlRenderer};
@ -45,10 +44,8 @@ pub const HTML_FOOTER: &str = "
</body>
";
lazy_static! {
static ref CSS_STYLES_BY_COLOR_ID: Vec<String> =
serde_json::from_str(include_str!("../vendor/xterm-colors.json")).unwrap();
}
static CSS_STYLES_BY_COLOR_ID: LazyLock<Vec<String>> =
LazyLock::new(|| serde_json::from_str(include_str!("../vendor/xterm-colors.json")).unwrap());
#[derive(Debug, Default)]
pub struct Style {