Skip to content

Commit

Permalink
remove lazy_static
Browse files Browse the repository at this point in the history
  • Loading branch information
ValiuchenkoVladyslav committed Dec 5, 2024
1 parent 0ba56be commit 4561a06
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ts-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ smol_str = { version = "0.3", optional = true }
indexmap = { version = "2", optional = true }
ordered-float = { version = ">= 3, < 5", optional = true }
serde_json = { version = "1", optional = true }
lazy_static = { version = "1", default-features = false }
tokio = { version = "1", features = ["sync"], optional = true }
10 changes: 4 additions & 6 deletions ts-rs/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use std::{
fs::File,
io::{Seek, SeekFrom},
path::{Component, Path, PathBuf},
sync::Mutex,
sync::{Mutex, LazyLock},
};

pub use error::ExportError;
use lazy_static::lazy_static;
use path::diff_paths;
pub(crate) use recursive_export::export_all_into;

Expand All @@ -19,9 +18,8 @@ use crate::TS;
mod error;
mod path;

lazy_static! {
static ref EXPORT_PATHS: Mutex<HashMap<PathBuf, HashSet<String>>> = Mutex::new(HashMap::new());
}
static EXPORT_PATHS: LazyLock<Mutex<HashMap<PathBuf, HashSet<String>>>> =
LazyLock::new(|| Default::default());

const NOTE: &str = "// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n";

Expand Down Expand Up @@ -139,7 +137,7 @@ fn export_and_merge(
) -> Result<(), ExportError> {
use std::io::{Read, Write};

let mut lock = EXPORT_PATHS.lock().unwrap();
let lock = &mut EXPORT_PATHS.lock().unwrap();

let Some(entry) = lock.get_mut(&path) else {
// The file hasn't been written to yet, so it must be
Expand Down

0 comments on commit 4561a06

Please sign in to comment.