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

@ -14,6 +14,7 @@ use std::{
mem,
path::{Path, PathBuf},
process::Command,
sync::LazyLock,
time::SystemTime,
};
@ -23,7 +24,6 @@ use anyhow::{anyhow, Context, Result};
use etcetera::BaseStrategy as _;
use fs4::fs_std::FileExt;
use indoc::indoc;
use lazy_static::lazy_static;
use libloading::{Library, Symbol};
use once_cell::unsync::OnceCell;
use path_slash::PathBufExt as _;
@ -41,9 +41,8 @@ use tree_sitter_highlight::HighlightConfiguration;
use tree_sitter_tags::{Error as TagsError, TagsConfiguration};
use url::Url;
lazy_static! {
static ref GRAMMAR_NAME_REGEX: Regex = Regex::new(r#""name":\s*"(.*?)""#).unwrap();
}
static GRAMMAR_NAME_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r#""name":\s*"(.*?)""#).unwrap());
pub const EMSCRIPTEN_TAG: &str = concat!("docker.io/emscripten/emsdk:", env!("EMSCRIPTEN_VERSION"));