From cc74be5d2163fbb1e9d57f85d5546857c6602446 Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 30 Jul 2024 07:45:29 +0800 Subject: refactor: several improvements (#765) --- src/client/access_token.rs | 3 +-- src/client/common.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/client') diff --git a/src/client/access_token.rs b/src/client/access_token.rs index 07640d5..0f69d9a 100644 --- a/src/client/access_token.rs +++ b/src/client/access_token.rs @@ -1,10 +1,9 @@ use anyhow::{anyhow, Result}; use chrono::Utc; use indexmap::IndexMap; -use lazy_static::lazy_static; use parking_lot::RwLock; -lazy_static! { +lazy_static::lazy_static! { static ref ACCESS_TOKENS: RwLock> = RwLock::new(IndexMap::new()); } diff --git a/src/client/common.rs b/src/client/common.rs index ec1f37d..684d10e 100644 --- a/src/client/common.rs +++ b/src/client/common.rs @@ -10,7 +10,6 @@ use crate::{ use anyhow::{bail, Context, Result}; use fancy_regex::Regex; use indexmap::IndexMap; -use lazy_static::lazy_static; use reqwest::{Client as ReqwestClient, RequestBuilder}; use serde::Deserialize; use serde_json::{json, Value}; @@ -19,7 +18,7 @@ use tokio::sync::mpsc::unbounded_channel; const MODELS_YAML: &str = include_str!("../../models.yaml"); -lazy_static! { +lazy_static::lazy_static! { pub static ref ALL_MODELS: Vec = serde_yaml::from_str(MODELS_YAML).unwrap(); static ref ESCAPE_SLASH_RE: Regex = Regex::new(r"(?