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/config/role.rs | |
| parent | a71e7c6be72965afd537aae076e0aee9e6f0755e (diff) | |
| download | aichat-dd8f3e4528d45b7602df7ea6380b92a87dc4f711.tar.gz | |
refactor: replace `lazy_static` with `std::sync::LazyLock` (#1246)
Diffstat (limited to 'src/config/role.rs')
| -rw-r--r-- | src/config/role.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/config/role.rs b/src/config/role.rs index cf5be62..9bdfe6c 100644 --- a/src/config/role.rs +++ b/src/config/role.rs @@ -7,6 +7,7 @@ use fancy_regex::Regex; use rust_embed::Embed; use serde::{Deserialize, Serialize}; use serde_json::Value; +use std::sync::LazyLock; pub const SHELL_ROLE: &str = "%shell%"; pub const EXPLAIN_SHELL_ROLE: &str = "%explain-shell%"; @@ -19,9 +20,8 @@ pub const INPUT_PLACEHOLDER: &str = "__INPUT__"; #[folder = "assets/roles/"] struct RolesAsset; -lazy_static::lazy_static! { - static ref RE_METADATA: Regex = Regex::new(r"(?s)-{3,}\s*(.*?)\s*-{3,}\s*(.*)").unwrap(); -} +static RE_METADATA: LazyLock<Regex> = + LazyLock::new(|| Regex::new(r"(?s)-{3,}\s*(.*?)\s*-{3,}\s*(.*)").unwrap()); pub trait RoleLike { fn to_role(&self) -> Role; |
