mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 11:39:35 +00:00
replace lazy_static!
with once_cell::sync::Lazy
This commit is contained in:
parent
de41be6e26
commit
bd3272a9f2
6 changed files with 14 additions and 17 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -8387,8 +8387,8 @@ dependencies = [
|
|||
"flexible-transcript",
|
||||
"hex",
|
||||
"jsonrpsee",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rand_core",
|
||||
"reqwest",
|
||||
"schnorr-signatures",
|
||||
|
@ -8503,10 +8503,10 @@ dependencies = [
|
|||
"futures",
|
||||
"hex",
|
||||
"k256",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"modular-frost",
|
||||
"monero-serai",
|
||||
"once_cell",
|
||||
"parity-scale-codec",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
|
|
|
@ -15,7 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
|
||||
[dependencies]
|
||||
# Macros
|
||||
lazy_static = { version = "1", default-features = false }
|
||||
once_cell = { version = "1", default-features = false }
|
||||
serde = { version = "1", default-features = false, features = ["std", "derive"] }
|
||||
|
||||
# Encoders
|
||||
|
|
|
@ -28,12 +28,11 @@ mod binaries {
|
|||
#[allow(clippy::type_complexity)]
|
||||
mod clippy {
|
||||
use super::*;
|
||||
lazy_static::lazy_static! {
|
||||
pub(crate) static ref KEYS: Arc<RwLock<HashMap<Service, <Ristretto as Ciphersuite>::G>>> =
|
||||
Arc::new(RwLock::new(HashMap::new()));
|
||||
pub(crate) static ref QUEUES: Arc<RwLock<HashMap<(Service, Service), RwLock<Queue<Db>>>>> =
|
||||
Arc::new(RwLock::new(HashMap::new()));
|
||||
}
|
||||
use once_cell::sync::Lazy;
|
||||
pub(crate) static KEYS: Lazy<Arc<RwLock<HashMap<Service, <Ristretto as Ciphersuite>::G>>>> =
|
||||
Lazy::new(|| Arc::new(RwLock::new(HashMap::new())));
|
||||
pub(crate) static QUEUES: Lazy<Arc<RwLock<HashMap<(Service, Service), RwLock<Queue<Db>>>>>> =
|
||||
Lazy::new(|| Arc::new(RwLock::new(HashMap::new())));
|
||||
}
|
||||
pub(crate) use self::clippy::*;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
# Macros
|
||||
async-trait = { version = "0.1", default-features = false }
|
||||
lazy_static = { version = "1", default-features = false }
|
||||
once_cell = { version = "1", default-features = false }
|
||||
zeroize = { version = "1", default-features = false, features = ["std"] }
|
||||
thiserror = { version = "1", default-features = false }
|
||||
serde = { version = "1", default-features = false, features = ["std", "derive"] }
|
||||
|
|
|
@ -53,6 +53,8 @@ use crate::{
|
|||
Payment,
|
||||
};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct OutputId(pub [u8; 36]);
|
||||
impl Default for OutputId {
|
||||
|
@ -259,10 +261,8 @@ impl BlockTrait<Bitcoin> for Block {
|
|||
}
|
||||
|
||||
const KEY_DST: &[u8] = b"Serai Bitcoin Output Offset";
|
||||
lazy_static::lazy_static! {
|
||||
static ref BRANCH_OFFSET: Scalar = Secp256k1::hash_to_F(KEY_DST, b"branch");
|
||||
static ref CHANGE_OFFSET: Scalar = Secp256k1::hash_to_F(KEY_DST, b"change");
|
||||
}
|
||||
static BRANCH_OFFSET: Lazy<Scalar> = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"branch"));
|
||||
static CHANGE_OFFSET: Lazy<Scalar> = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"change"));
|
||||
|
||||
// Always construct the full scanner in order to ensure there's no collisions
|
||||
fn scanner(
|
||||
|
|
|
@ -16,9 +16,7 @@ mod addresses;
|
|||
pub(crate) use addresses::test_addresses;
|
||||
|
||||
// Effective Once
|
||||
lazy_static::lazy_static! {
|
||||
static ref INIT_LOGGER: () = env_logger::init();
|
||||
}
|
||||
static INIT_LOGGER: once_cell::sync::Lazy<()> = once_cell::sync::Lazy::new(env_logger::init);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_network {
|
||||
|
|
Loading…
Reference in a new issue