Skip to content

agave-install: swap lazy_static import with std::sync::LazyLock #5850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion install/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ crossbeam-channel = { workspace = true }
ctrlc = { workspace = true, features = ["termination"] }
dirs-next = { workspace = true }
indicatif = { workspace = true }
lazy_static = { workspace = true }
nix = { workspace = true, features = ["signal"] }
reqwest = { workspace = true, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
scopeguard = { workspace = true }
Expand Down
42 changes: 22 additions & 20 deletions install/src/defaults.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
use std::sync::LazyLock;

pub const JSON_RPC_URL: &str = "http://api.devnet.solana.com";

lazy_static! {
pub static ref CONFIG_FILE: Option<String> = {
dirs_next::home_dir().map(|mut path| {
path.extend([".config", "solana", "install", "config.yml"]);
path.to_str().unwrap().to_string()
})
};
pub static ref USER_KEYPAIR: Option<String> = {
dirs_next::home_dir().map(|mut path| {
path.extend([".config", "solana", "id.json"]);
path.to_str().unwrap().to_string()
})
};
pub static ref DATA_DIR: Option<String> = {
dirs_next::home_dir().map(|mut path| {
path.extend([".local", "share", "solana", "install"]);
path.to_str().unwrap().to_string()
})
};
}
pub static CONFIG_FILE: LazyLock<Option<String>> = LazyLock::new(|| {
dirs_next::home_dir().map(|mut path| {
path.extend([".config", "solana", "install", "config.yml"]);
path.to_str().unwrap().to_string()
})
});

pub static USER_KEYPAIR: LazyLock<Option<String>> = LazyLock::new(|| {
dirs_next::home_dir().map(|mut path| {
path.extend([".config", "solana", "id.json"]);
path.to_str().unwrap().to_string()
})
});

pub static DATA_DIR: LazyLock<Option<String>> = LazyLock::new(|| {
dirs_next::home_dir().map(|mut path| {
path.extend([".local", "share", "solana", "install"]);
path.to_str().unwrap().to_string()
})
});
3 changes: 0 additions & 3 deletions install/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#![allow(clippy::arithmetic_side_effects)]
#[macro_use]
extern crate lazy_static;

use {
clap::{crate_description, crate_name, App, AppSettings, Arg, ArgMatches, SubCommand},
solana_clap_utils::{
Expand Down
Loading