summaryrefslogtreecommitdiffstats
path: root/src/utils/variables.rs
diff options
context:
space:
mode:
authormtul0729 <52401682+mtul0729@users.noreply.github.com>2025-03-26 08:34:00 +0800
committerGitHub <noreply@github.com>2025-03-26 08:34:00 +0800
commitdd8f3e4528d45b7602df7ea6380b92a87dc4f711 (patch)
treefaf8368ed6e06a78547959414710848ff19a06ff /src/utils/variables.rs
parenta71e7c6be72965afd537aae076e0aee9e6f0755e (diff)
downloadaichat-dd8f3e4528d45b7602df7ea6380b92a87dc4f711.tar.gz
refactor: replace `lazy_static` with `std::sync::LazyLock` (#1246)
Diffstat (limited to 'src/utils/variables.rs')
-rw-r--r--src/utils/variables.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/utils/variables.rs b/src/utils/variables.rs
index 91c9912..bfec4ca 100644
--- a/src/utils/variables.rs
+++ b/src/utils/variables.rs
@@ -1,9 +1,8 @@
use super::*;
use fancy_regex::{Captures, Regex};
+use std::sync::LazyLock;
-lazy_static::lazy_static! {
- pub static ref RE_VARIABLE: Regex = Regex::new(r"\{\{(\w+)\}\}").unwrap();
-}
+pub static RE_VARIABLE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\{\{(\w+)\}\}").unwrap());
pub fn interpolate_variables(text: &mut String) {
*text = RE_VARIABLE
.replace_all(text, |caps: &Captures<'_>| {