diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index 076b7128c8..59e8d212c0 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -23,7 +23,6 @@ url = { workspace = true } clap = { workspace = true, features = ["cargo", "derive"] } dirs = "4.0" -lazy_static = "1.4.0" log = { workspace = true } # self explanatory pretty_env_logger = "0.4" # for formatting log messages rand = { version = "0.7.3", features = ["wasm-bindgen"] } # rng-related traits + some rng implementation to use diff --git a/clients/native/src/commands/mod.rs b/clients/native/src/commands/mod.rs index 3ebe929b16..c49b197f62 100644 --- a/clients/native/src/commands/mod.rs +++ b/clients/native/src/commands/mod.rs @@ -8,7 +8,6 @@ use crate::client::config::{BaseClientConfig, Config}; use crate::error::ClientError; use clap::CommandFactory; use clap::{Parser, Subcommand}; -use lazy_static::lazy_static; use log::{error, info}; use nym_bin_common::bin_info; use nym_bin_common::completions::{fig_generate, ArgShell}; @@ -21,18 +20,16 @@ use nym_client_core::error::ClientCoreError; use nym_config::OptionalSet; use std::error::Error; use std::net::IpAddr; +use std::sync::OnceLock; pub(crate) mod build_info; +pub(crate) mod import_credential; pub(crate) mod init; pub(crate) mod run; -lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 89edffb4fc..00a1932209 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -9,7 +9,6 @@ license.workspace = true [dependencies] clap = { workspace = true, features = ["cargo", "derive"] } -lazy_static = "1.4.0" log = { workspace = true } pretty_env_logger = "0.4" serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization diff --git a/clients/socks5/src/commands/mod.rs b/clients/socks5/src/commands/mod.rs index 7bd5205791..3b2ebd25fa 100644 --- a/clients/socks5/src/commands/mod.rs +++ b/clients/socks5/src/commands/mod.rs @@ -9,7 +9,6 @@ use crate::config::{BaseClientConfig, Config, SocksClientPaths}; use crate::error::Socks5ClientError; use clap::CommandFactory; use clap::{Parser, Subcommand}; -use lazy_static::lazy_static; use log::{error, info}; use nym_bin_common::bin_info; use nym_bin_common::completions::{fig_generate, ArgShell}; @@ -24,18 +23,15 @@ use nym_config::OptionalSet; use nym_sphinx::params::{PacketSize, PacketType}; use std::error::Error; use std::net::IpAddr; +use std::sync::OnceLock; pub(crate) mod build_info; pub mod init; pub(crate) mod run; -lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/explorer-api/Cargo.toml b/explorer-api/Cargo.toml index f4d132d92a..eaf3876402 100644 --- a/explorer-api/Cargo.toml +++ b/explorer-api/Cargo.toml @@ -13,7 +13,6 @@ dotenvy = { workspace = true } humantime-serde = "1.0" isocountry = "0.3.2" itertools = "0.10.3" -lazy_static = "1.4.0" log = { workspace = true } maxminddb = "0.23.0" okapi = { version = "0.7.0", features = ["impl_json_schema"] } diff --git a/explorer-api/src/commands/mod.rs b/explorer-api/src/commands/mod.rs index 1e19d2efce..0c0855d065 100644 --- a/explorer-api/src/commands/mod.rs +++ b/explorer-api/src/commands/mod.rs @@ -2,16 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 use clap::Parser; -use lazy_static::lazy_static; use nym_bin_common::bin_info; +use std::sync::OnceLock; -lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 51f0307f76..ac7aefb4a4 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -29,7 +29,6 @@ dotenvy = { workspace = true } futures = { workspace = true } humantime-serde = "1.0.1" ipnetwork = "0.16" -lazy_static = "1.4.0" log = { workspace = true } once_cell = "1.7.2" pretty_env_logger = "0.4" diff --git a/gateway/src/main.rs b/gateway/src/main.rs index 0ec4b7865a..f88398e0b9 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -6,13 +6,13 @@ use clap::{crate_name, crate_version, Parser}; use colored::Colorize; -use lazy_static::lazy_static; use log::error; use nym_bin_common::bin_info; use nym_bin_common::logging::{maybe_print_banner, setup_logging}; use nym_bin_common::output_format::OutputFormat; use nym_network_defaults::setup_env; use std::error::Error; +use std::sync::OnceLock; mod commands; mod config; @@ -21,13 +21,9 @@ mod http; mod node; pub(crate) mod support; -lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 9ad7c5081f..a15308cb4a 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -26,7 +26,6 @@ cupid = "0.6.1" dirs = "4.0" futures = { workspace = true } humantime-serde = "1.0" -lazy_static = "1.4.0" log = { workspace = true } rand = "0.7.3" serde = { workspace = true, features = ["derive"] } diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index d6383477cc..a7b1592776 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -3,9 +3,9 @@ use ::nym_config::defaults::setup_env; use clap::{crate_name, crate_version, Parser}; -use lazy_static::lazy_static; use log::info; use nym_bin_common::bin_info; +use std::sync::OnceLock; #[allow(unused_imports)] use nym_bin_common::logging::{maybe_print_banner, setup_logging}; @@ -21,13 +21,9 @@ mod config; pub(crate) mod error; mod node; -lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index 536f7915a8..5a5f31d778 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -27,7 +27,6 @@ futures = { workspace = true } itertools = "0.12.0" humantime-serde = "1.0" k256 = { version = "*", features = ["ecdsa-core"] } # needed for the Verifier trait; pull whatever version is used by other dependencies -lazy_static = "1.4.0" log = { workspace = true } pin-project = "1.0" rand = "0.8.5" diff --git a/sdk/lib/socks5-listener/Cargo.toml b/sdk/lib/socks5-listener/Cargo.toml index 425154a5cb..129afb5e87 100644 --- a/sdk/lib/socks5-listener/Cargo.toml +++ b/sdk/lib/socks5-listener/Cargo.toml @@ -16,7 +16,6 @@ crate-type = ["cdylib", "staticlib", "rlib"] [dependencies] anyhow = { workspace = true } futures = { workspace = true } -lazy_static = "1.4.0" nym-bin-common = { path = "../../../common/bin-common"} nym-client-core = { path = "../../../common/client-core", default-features = false } nym-config-common = { path = "../../../common/config", package = "nym-config" } diff --git a/sdk/lib/socks5-listener/src/lib.rs b/sdk/lib/socks5-listener/src/lib.rs index 0c9e2f7771..352638f84d 100644 --- a/sdk/lib/socks5-listener/src/lib.rs +++ b/sdk/lib/socks5-listener/src/lib.rs @@ -5,7 +5,6 @@ use crate::config::{config_filepath_from_root, Config}; use crate::persistence::MobileClientStorage; use ::safer_ffi::prelude::*; use anyhow::{anyhow, Result}; -use lazy_static::lazy_static; use log::{debug, info, warn}; use nym_bin_common::logging::setup_logging; use nym_client_core::init::helpers::current_gateways; diff --git a/service-providers/ip-packet-router/Cargo.toml b/service-providers/ip-packet-router/Cargo.toml index 39f3e33e48..ce6674550d 100644 --- a/service-providers/ip-packet-router/Cargo.toml +++ b/service-providers/ip-packet-router/Cargo.toml @@ -15,7 +15,6 @@ bytes = "1.5.0" clap.workspace = true etherparse = "0.13.0" futures = { workspace = true } -lazy_static.workspace = true log = { workspace = true } nym-bin-common = { path = "../../common/bin-common" } nym-client-core = { path = "../../common/client-core" } diff --git a/service-providers/ip-packet-router/src/cli/mod.rs b/service-providers/ip-packet-router/src/cli/mod.rs index d17391eaed..eda51a5554 100644 --- a/service-providers/ip-packet-router/src/cli/mod.rs +++ b/service-providers/ip-packet-router/src/cli/mod.rs @@ -8,6 +8,7 @@ use nym_client_core::client::base_client::storage::gateway_details::{ use nym_client_core::client::key_manager::persistence::OnDiskKeys; use nym_client_core::config::GatewayEndpointConfig; use nym_client_core::error::ClientCoreError; +use std::sync::OnceLock; use crate::config::{BaseClientConfig, Config}; use crate::error::IpPacketRouterError; @@ -17,13 +18,9 @@ mod init; mod run; mod sign; -lazy_static::lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)] diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index 7a2805cd17..323a11c286 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -24,7 +24,6 @@ dirs = "4.0" futures = { workspace = true } humantime-serde = "1.1.1" ipnetwork = "0.20.0" -lazy_static = { workspace = true } log = { workspace = true } pretty_env_logger = "0.4.0" publicsuffix = "2.2.3" diff --git a/service-providers/network-requester/src/cli/mod.rs b/service-providers/network-requester/src/cli/mod.rs index 2dba60cb16..874f191134 100644 --- a/service-providers/network-requester/src/cli/mod.rs +++ b/service-providers/network-requester/src/cli/mod.rs @@ -20,19 +20,16 @@ use nym_client_core::client::key_manager::persistence::OnDiskKeys; use nym_client_core::config::GatewayEndpointConfig; use nym_client_core::error::ClientCoreError; use nym_config::OptionalSet; +use std::sync::OnceLock; mod build_info; mod init; mod run; mod sign; -lazy_static::lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); -} - -// Helper for passing LONG_VERSION to clap fn pretty_build_info_static() -> &'static str { - &PRETTY_BUILD_INFORMATION + static PRETTY_BUILD_INFORMATION: OnceLock = OnceLock::new(); + PRETTY_BUILD_INFORMATION.get_or_init(|| bin_info!().pretty_print()) } #[derive(Parser)]