Skip to content

Commit 61d4b73

Browse files
committed
colors: remove lazy_static dependency and use LazyLock for COLORS
1 parent f7d7c73 commit 61d4b73

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ path = "src/main.rs"
1313

1414
[dependencies]
1515
nix = { version = "0.30", features = ["fs", "hostname", "feature"] }
16-
lazy_static = "1.5"
1716
libc = "0.2"
1817

1918
[dev-dependencies]

src/colors.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::env;
2+
use std::sync::LazyLock;
23

34
pub struct Colors {
45
pub reset: &'static str,
@@ -36,13 +37,11 @@ impl Colors {
3637
}
3738
}
3839

39-
lazy_static::lazy_static! {
40-
pub static ref COLORS: Colors = {
41-
// check for NO_COLOR once at startup
42-
let is_no_color = env::var("NO_COLOR").is_ok();
43-
Colors::new(is_no_color)
44-
};
45-
}
40+
pub static COLORS: LazyLock<Colors> = LazyLock::new(|| {
41+
// check for NO_COLOR once at startup
42+
let is_no_color = env::var("NO_COLOR").is_ok();
43+
Colors::new(is_no_color)
44+
});
4645

4746
pub fn print_dots() -> String {
4847
format!(

0 commit comments

Comments
 (0)