colors: remove lazy_static dependency and use LazyLock for COLORS

This commit is contained in:
raf 2025-06-22 02:53:21 +03:00
commit 61d4b7377f
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 6 additions and 15 deletions

View file

@ -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!(