Skip to content

Commit 45f66dc

Browse files
authored
agave-install: swap lazy_static import with std::sync::LazyLock (#5850)
* swap lazy_static! import with std::sync::LazyLock * update thru ./scripts/cargo-for-all-lock-files.sh
1 parent ebae35e commit 45f66dc

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ crossbeam-channel = { workspace = true }
2020
ctrlc = { workspace = true, features = ["termination"] }
2121
dirs-next = { workspace = true }
2222
indicatif = { workspace = true }
23-
lazy_static = { workspace = true }
2423
nix = { workspace = true, features = ["signal"] }
2524
reqwest = { workspace = true, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
2625
scopeguard = { workspace = true }

install/src/defaults.rs

+22-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1+
use std::sync::LazyLock;
2+
13
pub const JSON_RPC_URL: &str = "http://api.devnet.solana.com";
24

3-
lazy_static! {
4-
pub static ref CONFIG_FILE: Option<String> = {
5-
dirs_next::home_dir().map(|mut path| {
6-
path.extend([".config", "solana", "install", "config.yml"]);
7-
path.to_str().unwrap().to_string()
8-
})
9-
};
10-
pub static ref USER_KEYPAIR: Option<String> = {
11-
dirs_next::home_dir().map(|mut path| {
12-
path.extend([".config", "solana", "id.json"]);
13-
path.to_str().unwrap().to_string()
14-
})
15-
};
16-
pub static ref DATA_DIR: Option<String> = {
17-
dirs_next::home_dir().map(|mut path| {
18-
path.extend([".local", "share", "solana", "install"]);
19-
path.to_str().unwrap().to_string()
20-
})
21-
};
22-
}
5+
pub static CONFIG_FILE: LazyLock<Option<String>> = LazyLock::new(|| {
6+
dirs_next::home_dir().map(|mut path| {
7+
path.extend([".config", "solana", "install", "config.yml"]);
8+
path.to_str().unwrap().to_string()
9+
})
10+
});
11+
12+
pub static USER_KEYPAIR: LazyLock<Option<String>> = LazyLock::new(|| {
13+
dirs_next::home_dir().map(|mut path| {
14+
path.extend([".config", "solana", "id.json"]);
15+
path.to_str().unwrap().to_string()
16+
})
17+
});
18+
19+
pub static DATA_DIR: LazyLock<Option<String>> = LazyLock::new(|| {
20+
dirs_next::home_dir().map(|mut path| {
21+
path.extend([".local", "share", "solana", "install"]);
22+
path.to_str().unwrap().to_string()
23+
})
24+
});

install/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#![allow(clippy::arithmetic_side_effects)]
2-
#[macro_use]
3-
extern crate lazy_static;
4-
52
use {
63
clap::{crate_description, crate_name, App, AppSettings, Arg, ArgMatches, SubCommand},
74
solana_clap_utils::{

0 commit comments

Comments
 (0)