From 095fa1227a437b1696fb85fe2eaea577aec76724 Mon Sep 17 00:00:00 2001 From: Dmitry Shlagoff Date: Tue, 12 May 2026 15:39:35 +0200 Subject: [PATCH] replace lazy_static macro with std::sync::LazyLock --- .gitignore | 2 +- Cargo.lock | 1 - Cargo.toml | 1 - src/machine/mod.rs | 7 ++----- src/machine/system_calls.rs | 6 ++---- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c2e60e69..0679a08c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ src/static_atoms.rs target/ .direnv/ - +.idea/ \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d00508e5..5da7eda0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2720,7 +2720,6 @@ dependencies = [ "iai-callgrind", "indexmap", "js-sys", - "lazy_static", "lexical", "libc", "libffi", diff --git a/Cargo.toml b/Cargo.toml index 39801345..b5815db1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,6 @@ futures = "0.3" fxhash = "0.2.1" git-version = "0.3.9" indexmap = "2.3.0" -lazy_static = "1.5.0" lexical = "7.0.4" libc = "0.2.155" libloading = "0.8" diff --git a/src/machine/mod.rs b/src/machine/mod.rs index a38a1baa..487fadcc 100644 --- a/src/machine/mod.rs +++ b/src/machine/mod.rs @@ -52,7 +52,6 @@ use crate::parser::dashu::{Integer, Rational}; use crate::types::*; use indexmap::IndexMap; -use lazy_static::lazy_static; use ordered_float::OrderedFloat; use rand::rngs::StdRng; @@ -63,11 +62,9 @@ use std::io::Read; use std::path::PathBuf; use std::process::ExitCode; use std::sync::atomic::AtomicBool; -use std::sync::OnceLock; +use std::sync::{LazyLock, OnceLock}; -lazy_static! { - pub static ref INTERRUPT: AtomicBool = AtomicBool::new(false); -} +pub static INTERRUPT: LazyLock = LazyLock::new(|| AtomicBool::new(false)); /// An instance of Scryer Prolog. /// diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index b48d3a1b..aac650a1 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -1,6 +1,5 @@ use base64::Engine; use dashu::integer::{Sign, UBig}; -use lazy_static::lazy_static; use num_order::NumOrd; use crate::arena::*; @@ -60,6 +59,7 @@ use std::process::Child; use std::process::Stdio; #[cfg(feature = "http")] use std::str::FromStr; +use std::sync::LazyLock; #[cfg(feature = "http")] use std::sync::{Arc, Condvar, Mutex}; @@ -9512,9 +9512,7 @@ impl Machine { fn rng() -> &'static dyn SecureRandom { use std::ops::Deref; - lazy_static! { - static ref RANDOM: SystemRandom = SystemRandom::new(); - } + static RANDOM: LazyLock = LazyLock::new(|| SystemRandom::new()); RANDOM.deref() } -- 2.54.0