Skip to content

Commit

Permalink
Convert lazy static to once_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Nov 29, 2023
1 parent dcb2253 commit f503b87
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ structopt = { version = "0.3.13", default_features = false }
tempfile = "3.1.0"
thiserror = "1.0.29"
toml = { version = "0.5", optional = true }
once_cell = "1.18.0"

[dev-dependencies]
tari_test_utils = { path = "../infrastructure/test_utils"}
Expand Down
6 changes: 2 additions & 4 deletions common/src/configuration/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ use std::{
sync::Mutex,
};

use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use structopt::lazy_static::lazy_static;

use crate::ConfigurationError;

lazy_static! {
pub static ref CURRENT_NETWORK: Mutex<Network> = Mutex::new(Network::default());
}
pub static CURRENT_NETWORK: Lazy<Mutex<Network>> = Lazy::new(|| Mutex::new(Network::default()));

/// Represents the available Tari p2p networks. Only nodes with matching byte values will be able to connect, so these
/// should never be changed once released.
Expand Down

0 comments on commit f503b87

Please sign in to comment.