replace lazy_static macro with std::sync::LazyLock

This commit is contained in:
Dmitry Shlagoff
2026-05-12 15:39:35 +02:00
parent 8dffd72db5
commit 095fa1227a
5 changed files with 5 additions and 12 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@ src/static_atoms.rs
target/ target/
.direnv/ .direnv/
.idea/

1
Cargo.lock generated
View File

@@ -2720,7 +2720,6 @@ dependencies = [
"iai-callgrind", "iai-callgrind",
"indexmap", "indexmap",
"js-sys", "js-sys",
"lazy_static",
"lexical", "lexical",
"libc", "libc",
"libffi", "libffi",

View File

@@ -62,7 +62,6 @@ futures = "0.3"
fxhash = "0.2.1" fxhash = "0.2.1"
git-version = "0.3.9" git-version = "0.3.9"
indexmap = "2.3.0" indexmap = "2.3.0"
lazy_static = "1.5.0"
lexical = "7.0.4" lexical = "7.0.4"
libc = "0.2.155" libc = "0.2.155"
libloading = "0.8" libloading = "0.8"

View File

@@ -52,7 +52,6 @@ use crate::parser::dashu::{Integer, Rational};
use crate::types::*; use crate::types::*;
use indexmap::IndexMap; use indexmap::IndexMap;
use lazy_static::lazy_static;
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
use rand::rngs::StdRng; use rand::rngs::StdRng;
@@ -63,11 +62,9 @@ use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::ExitCode; use std::process::ExitCode;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use std::sync::OnceLock; use std::sync::{LazyLock, OnceLock};
lazy_static! { pub static INTERRUPT: LazyLock<AtomicBool> = LazyLock::new(|| AtomicBool::new(false));
pub static ref INTERRUPT: AtomicBool = AtomicBool::new(false);
}
/// An instance of Scryer Prolog. /// An instance of Scryer Prolog.
/// ///

View File

@@ -1,6 +1,5 @@
use base64::Engine; use base64::Engine;
use dashu::integer::{Sign, UBig}; use dashu::integer::{Sign, UBig};
use lazy_static::lazy_static;
use num_order::NumOrd; use num_order::NumOrd;
use crate::arena::*; use crate::arena::*;
@@ -60,6 +59,7 @@ use std::process::Child;
use std::process::Stdio; use std::process::Stdio;
#[cfg(feature = "http")] #[cfg(feature = "http")]
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
#[cfg(feature = "http")] #[cfg(feature = "http")]
use std::sync::{Arc, Condvar, Mutex}; use std::sync::{Arc, Condvar, Mutex};
@@ -9512,9 +9512,7 @@ impl Machine {
fn rng() -> &'static dyn SecureRandom { fn rng() -> &'static dyn SecureRandom {
use std::ops::Deref; use std::ops::Deref;
lazy_static! { static RANDOM: LazyLock<SystemRandom> = LazyLock::new(|| SystemRandom::new());
static ref RANDOM: SystemRandom = SystemRandom::new();
}
RANDOM.deref() RANDOM.deref()
} }