mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-26 17:23:41 +00:00
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:
@@ -1,7 +1,7 @@
|
||||
use lazy_static::lazy_static;
|
||||
use lru_cache::LRUTimeCache;
|
||||
use parking_lot::Mutex;
|
||||
use std::net::{SocketAddr, TcpListener, UdpSocket};
|
||||
use std::sync::LazyLock;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@@ -18,10 +18,8 @@ pub enum IpVersion {
|
||||
|
||||
pub const CACHED_PORTS_TTL: Duration = Duration::from_secs(300);
|
||||
|
||||
lazy_static! {
|
||||
static ref FOUND_PORTS_CACHE: Mutex<LRUTimeCache<u16>> =
|
||||
Mutex::new(LRUTimeCache::new(CACHED_PORTS_TTL));
|
||||
}
|
||||
static FOUND_PORTS_CACHE: LazyLock<Mutex<LRUTimeCache<u16>>> =
|
||||
LazyLock::new(|| Mutex::new(LRUTimeCache::new(CACHED_PORTS_TTL)));
|
||||
|
||||
/// A convenience wrapper over [`zero_port`].
|
||||
pub fn unused_tcp4_port() -> Result<u16, String> {
|
||||
|
||||
Reference in New Issue
Block a user