mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-11-26 01:02:50 +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
|
|
@ -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