From dd8f3e4528d45b7602df7ea6380b92a87dc4f711 Mon Sep 17 00:00:00 2001 From: mtul0729 <52401682+mtul0729@users.noreply.github.com> Date: Wed, 26 Mar 2025 08:34:00 +0800 Subject: refactor: replace `lazy_static` with `std::sync::LazyLock` (#1246) --- src/render/markdown.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/render/markdown.rs') diff --git a/src/render/markdown.rs b/src/render/markdown.rs index f5f532d..33cdf47 100644 --- a/src/render/markdown.rs +++ b/src/render/markdown.rs @@ -3,6 +3,7 @@ use anyhow::{anyhow, Context, Result}; use crossterm::style::{Color, Stylize}; use crossterm::terminal; use std::collections::HashMap; +use std::sync::LazyLock; use syntect::highlighting::{Color as SyntectColor, FontStyle, Style, Theme}; use syntect::parsing::SyntaxSet; use syntect::{easy::HighlightLines, parsing::SyntaxReference}; @@ -10,14 +11,12 @@ use syntect::{easy::HighlightLines, parsing::SyntaxReference}; /// Comes from const SYNTAXES: &[u8] = include_bytes!("../../assets/syntaxes.bin"); -lazy_static::lazy_static! { - static ref LANG_MAPS: HashMap = { - let mut m = HashMap::new(); - m.insert("csharp".into(), "C#".into()); - m.insert("php".into(), "PHP Source".into()); - m - }; -} +static LANG_MAPS: LazyLock> = LazyLock::new(|| { + let mut m = HashMap::new(); + m.insert("csharp".into(), "C#".into()); + m.insert("php".into(), "PHP Source".into()); + m +}); pub struct MarkdownRender { options: RenderOptions, -- cgit v1.2.3