Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lazy_static with once_cell #133

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions 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.17"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
Expand All @@ -27,6 +27,6 @@ features = [
"winbase"
]

[dev_dependencies]
[dev-dependencies]
ansi_term = "0.12"
rspec = "=1.0.0-beta.3"
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
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#![warn(missing_docs)]

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

Expand Down