Replace lazy_static! with LazyLock (#6189)

* Replace `lazy_static` with `LazyLock`.

* Merge branch 'unstable' into remove-lazy-static

# Conflicts:
#	beacon_node/lighthouse_network/src/peer_manager/mod.rs

* Lint fixes.

* Merge branch 'unstable' into remove-lazy-static

# Conflicts:
#	beacon_node/beacon_chain/src/metrics.rs

* Moar lint fixes.

* Update rust version to 1.80.0.

* Merge branch 'unstable' into remove-lazy-static
This commit is contained in:
Jimmy Chen
2024-07-29 21:42:31 +10:00
committed by GitHub
parent 00038dae81
commit 96b00ef66c
85 changed files with 3512 additions and 2370 deletions

View File

@@ -26,5 +26,4 @@ serde_yaml = { workspace = true }
eth2_network_config = { workspace = true }
serde_json = { workspace = true }
zip = { workspace = true }
lazy_static = { workspace = true }
parking_lot = { workspace = true }

View File

@@ -22,7 +22,6 @@ mod tests {
};
use eth2_keystore::KeystoreBuilder;
use eth2_network_config::Eth2NetworkConfig;
use lazy_static::lazy_static;
use parking_lot::Mutex;
use reqwest::Client;
use serde::Serialize;
@@ -33,7 +32,7 @@ mod tests {
use std::future::Future;
use std::path::PathBuf;
use std::process::{Child, Command, Stdio};
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use std::time::{Duration, Instant};
use task_executor::TaskExecutor;
use tempfile::{tempdir, TempDir};
@@ -57,12 +56,13 @@ mod tests {
/// debugging.
const SUPPRESS_WEB3SIGNER_LOGS: bool = true;
lazy_static! {
static ref TEMP_DIR: Arc<Mutex<TempDir>> = Arc::new(Mutex::new(
tempdir().expect("Failed to create temporary directory")
));
static ref GET_WEB3SIGNER_BIN: OnceCell<()> = OnceCell::new();
}
static TEMP_DIR: LazyLock<Arc<Mutex<TempDir>>> = LazyLock::new(|| {
Arc::new(Mutex::new(
tempdir().expect("Failed to create temporary directory"),
))
});
static GET_WEB3SIGNER_BIN: OnceCell<()> = OnceCell::const_new();
type E = MainnetEthSpec;