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

@@ -7,7 +7,6 @@ edition = { workspace = true }
[dependencies]
ethereum-types = { workspace = true }
ethereum_hashing = { workspace = true }
lazy_static = { workspace = true }
safe_arith = { workspace = true }
[dev-dependencies]

View File

@@ -1,17 +1,14 @@
use ethereum_hashing::{hash, hash32_concat, ZERO_HASHES};
use ethereum_types::H256;
use lazy_static::lazy_static;
use safe_arith::ArithError;
use std::sync::LazyLock;
const MAX_TREE_DEPTH: usize = 32;
const EMPTY_SLICE: &[H256] = &[];
lazy_static! {
/// Zero nodes to act as "synthetic" left and right subtrees of other zero nodes.
static ref ZERO_NODES: Vec<MerkleTree> = {
(0..=MAX_TREE_DEPTH).map(MerkleTree::Zero).collect()
};
}
/// Zero nodes to act as "synthetic" left and right subtrees of other zero nodes.
static ZERO_NODES: LazyLock<Vec<MerkleTree>> =
LazyLock::new(|| (0..=MAX_TREE_DEPTH).map(MerkleTree::Zero).collect());
/// Right-sparse Merkle tree.
///