Skip to content

Commit 8b90822

Browse files
committed
Don't use lazy_static
1 parent 29f2cb1 commit 8b90822

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

tr/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ mo-translator = ["dep:rspolib"]
1818
po-translator = ["dep:rspolib"]
1919

2020
[dependencies]
21-
lazy_static = "1.2"
2221
gettext-rs = { version = "0.7", optional = true, features = ["gettext-system"] }
2322
gettext = { version = "0.4", optional = true }
2423
rspolib = { version = "0.1.1", optional = true }

tr/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,10 @@ impl<T: Translator> Translator for std::sync::Arc<T> {
283283
pub mod internal {
284284

285285
use super::Translator;
286-
use std::{borrow::Cow, collections::HashMap, sync::RwLock};
286+
use std::{borrow::Cow, collections::HashMap, sync::LazyLock, sync::RwLock};
287287

288-
// TODO: use parking_lot::RwLock
289-
lazy_static::lazy_static! {
290-
static ref TRANSLATORS: RwLock<HashMap<&'static str, Box<dyn Translator>>> =
291-
Default::default();
292-
}
288+
static TRANSLATORS: LazyLock<RwLock<HashMap<&'static str, Box<dyn Translator>>>> =
289+
LazyLock::new(Default::default);
293290

294291
pub fn with_translator<T>(module: &'static str, func: impl FnOnce(&dyn Translator) -> T) -> T {
295292
let domain = domain_from_module(module);

0 commit comments

Comments
 (0)