diff options
| author | mtul0729 <52401682+mtul0729@users.noreply.github.com> | 2025-03-26 08:34:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-26 08:34:00 +0800 |
| commit | dd8f3e4528d45b7602df7ea6380b92a87dc4f711 (patch) | |
| tree | faf8368ed6e06a78547959414710848ff19a06ff /src/render | |
| parent | a71e7c6be72965afd537aae076e0aee9e6f0755e (diff) | |
| download | aichat-dd8f3e4528d45b7602df7ea6380b92a87dc4f711.tar.gz | |
refactor: replace `lazy_static` with `std::sync::LazyLock` (#1246)
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/markdown.rs | 15 |
1 files changed, 7 insertions, 8 deletions
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 <https://github.com/sharkdp/bat/raw/5e77ca37e89c873e4490b42ff556370dc5c6ba4f/assets/syntaxes.bin> const SYNTAXES: &[u8] = include_bytes!("../../assets/syntaxes.bin"); -lazy_static::lazy_static! { - static ref LANG_MAPS: HashMap<String, String> = { - let mut m = HashMap::new(); - m.insert("csharp".into(), "C#".into()); - m.insert("php".into(), "PHP Source".into()); - m - }; -} +static LANG_MAPS: LazyLock<HashMap<String, String>> = 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, |
