Skip to content

Commit

Permalink
Replace lazy_static with once_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 authored Sep 30, 2022
1 parent 11ffd20 commit 1d6b88d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ no-color = []

[dependencies]
atty = "0.2"
lazy_static = "1"
once_cell = "1"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
Expand Down
5 changes: 2 additions & 3 deletions src/control.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! A couple of functions to enable and disable coloring.
use once_cell::sync::Lazy;
use std::default::Default;
use std::env;
use std::sync::atomic::{AtomicBool, Ordering};
Expand Down Expand Up @@ -81,10 +82,8 @@ pub fn unset_override() {
SHOULD_COLORIZE.unset_override()
}

lazy_static! {
/// The persistent [`ShouldColorize`].
pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
}
pub static SHOULD_COLORIZE: Lazy<ShouldColorize> = Lazy::new(|| ShouldColorize::from_env());

impl Default for ShouldColorize {
fn default() -> ShouldColorize {
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#![warn(missing_docs)]

extern crate atty;
#[macro_use]
extern crate lazy_static;
#[cfg(windows)]
extern crate winapi;

Expand Down

0 comments on commit 1d6b88d

Please sign in to comment.