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/client/access_token.rs | |
| parent | a71e7c6be72965afd537aae076e0aee9e6f0755e (diff) | |
| download | aichat-dd8f3e4528d45b7602df7ea6380b92a87dc4f711.tar.gz | |
refactor: replace `lazy_static` with `std::sync::LazyLock` (#1246)
Diffstat (limited to 'src/client/access_token.rs')
| -rw-r--r-- | src/client/access_token.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/access_token.rs b/src/client/access_token.rs index 0f69d9a..e09e02c 100644 --- a/src/client/access_token.rs +++ b/src/client/access_token.rs @@ -2,11 +2,10 @@ use anyhow::{anyhow, Result}; use chrono::Utc; use indexmap::IndexMap; use parking_lot::RwLock; +use std::sync::LazyLock; -lazy_static::lazy_static! { - static ref ACCESS_TOKENS: RwLock<IndexMap<String, (String, i64)>> = - RwLock::new(IndexMap::new()); -} +static ACCESS_TOKENS: LazyLock<RwLock<IndexMap<String, (String, i64)>>> = + LazyLock::new(|| RwLock::new(IndexMap::new())); pub fn get_access_token(client_name: &str) -> Result<String> { ACCESS_TOKENS |
