Switch from lazy_static to once_cell (#442)

The latter will hopefully eventually be upstreamed into `std`.
This commit is contained in:
Tony Arcieri (iqlusion)
2022-11-14 13:52:27 -07:00
committed by GitHub
parent 57bb088c7d
commit 5c4259023f
5 changed files with 15 additions and 22 deletions
+7 -9
View File
@@ -1,7 +1,7 @@
//! Status messages
use lazy_static::lazy_static;
use log::debug;
use once_cell::sync::Lazy;
use sha2::{Digest, Sha256};
use std::{
io::{self, Write},
@@ -59,16 +59,14 @@ macro_rules! status_err {
};
}
lazy_static! {
/// Color configuration
static ref COLOR_CHOICE: Mutex<Option<ColorChoice>> = Mutex::new(None);
/// Color configuration
static COLOR_CHOICE: Lazy<Mutex<Option<ColorChoice>>> = Lazy::new(|| Mutex::new(None));
/// Standard output
pub static ref STDOUT: StandardStream = StandardStream::stdout(get_color_choice());
/// Standard output
pub static STDOUT: Lazy<StandardStream> = Lazy::new(|| StandardStream::stdout(get_color_choice()));
/// Standard error
pub static ref STDERR: StandardStream = StandardStream::stderr(get_color_choice());
}
/// Standard error
pub static STDERR: Lazy<StandardStream> = Lazy::new(|| StandardStream::stderr(get_color_choice()));
/// Obtain the color configuration.
///