Skip to content

Commit

Permalink
Remove unnecessary lazy_static dependency (#176)
Browse files Browse the repository at this point in the history
This removes the `lazy_static` dependency, bumping the MSRV and this crate's major version.
---------

Co-authored-by: Spenser Black <[email protected]>
Co-authored-by: tison <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent 037e091 commit 95b2de8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu", "windows", "macos"]
version: ["stable", "beta", "1.70"]
version: ["stable", "beta", "1.80"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -59,4 +59,3 @@ jobs:
uses: actions/checkout@v3
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Unreleased

# 3.0.0
- **[BREAKING CHANGE]:** Upgrade MSRV to 1.80 and remove the then unnecessary lazy_static dependency.

# 2.2.0
- Updated top-level docs to include a note about `ColoredString`\'s role in the `Colorize` pipeline as well as link to it to suggest learning more about how to manipulate existing `ColoredString`\'s.
- Changes to `ColoredString`:
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
[package]
name = "colored"
description = "The most simple way to add colors in your terminal"
version = "2.2.0"
version = "3.0.0"
edition = "2021"
authors = ["Thomas Wickham <[email protected]>"]
license = "MPL-2.0"
homepage = "https://github.com/mackwic/colored"
repository = "https://github.com/mackwic/colored"
readme = "README.md"
keywords = ["color", "string", "term", "ansi_term", "term-painter"]
rust-version = "1.70"
rust-version = "1.80"

[features]
# with this feature, no color will ever be written
no-color = []

[dependencies]
lazy_static = "1"

[target.'cfg(windows)'.dependencies.windows-sys]
version = ">=0.48,<=0.59"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ providing a reference implementation, which greatly helped making this crate
output correct strings.

## Minimum Supported Rust Version (MSRV)
The current MSRV is `1.70`, which is checked and enforced automatically via CI. This version may change in the future in minor version bumps, so if you require a specific Rust version you should use a restricted version requirement such as `~X.Y`.
The current MSRV is `1.80`, which is checked and enforced automatically via CI. This version may change in the future in minor version bumps, so if you require a specific Rust version you should use a restricted version requirement such as `~X.Y`.

## License

Expand Down
5 changes: 2 additions & 3 deletions src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::default::Default;
use std::env;
use std::io::{self, IsTerminal};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::LazyLock;

/// Sets a flag to the console to use a virtual terminal environment.
///
Expand Down Expand Up @@ -78,10 +79,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: LazyLock<ShouldColorize> = LazyLock::new(ShouldColorize::from_env);

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

#[macro_use]
extern crate lazy_static;

#[cfg(test)]
extern crate rspec;

Expand Down

0 comments on commit 95b2de8

Please sign in to comment.