mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-10-02 19:53:27 +00:00
colors: remove lazy_static dependency and use LazyLock for COLORS
This commit is contained in:
parent
f7d7c73073
commit
61d4b7377f
3 changed files with 6 additions and 15 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -236,12 +236,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.171"
|
||||
|
@ -265,7 +259,6 @@ name = "microfetch"
|
|||
version = "0.4.8"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"nix",
|
||||
]
|
||||
|
|
|
@ -13,7 +13,6 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
nix = { version = "0.30", features = ["fs", "hostname", "feature"] }
|
||||
lazy_static = "1.5"
|
||||
libc = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use std::env;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub struct Colors {
|
||||
pub reset: &'static str,
|
||||
|
@ -36,13 +37,11 @@ impl Colors {
|
|||
}
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref COLORS: Colors = {
|
||||
// check for NO_COLOR once at startup
|
||||
let is_no_color = env::var("NO_COLOR").is_ok();
|
||||
Colors::new(is_no_color)
|
||||
};
|
||||
}
|
||||
pub static COLORS: LazyLock<Colors> = LazyLock::new(|| {
|
||||
// check for NO_COLOR once at startup
|
||||
let is_no_color = env::var("NO_COLOR").is_ok();
|
||||
Colors::new(is_no_color)
|
||||
});
|
||||
|
||||
pub fn print_dots() -> String {
|
||||
format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue