Skip to content

Commit 95b2de8

Browse files
atezetspenserblacktisonkun
authored
Remove unnecessary lazy_static dependency (#176)
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]>
1 parent 037e091 commit 95b2de8

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

.github/workflows/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
strategy:
4141
matrix:
4242
os: ["ubuntu", "windows", "macos"]
43-
version: ["stable", "beta", "1.70"]
43+
version: ["stable", "beta", "1.80"]
4444
steps:
4545
- name: Checkout repository
4646
uses: actions/checkout@v3
@@ -59,4 +59,3 @@ jobs:
5959
uses: actions/checkout@v3
6060
- name: Check semver
6161
uses: obi1kenobi/cargo-semver-checks-action@v2
62-

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Unreleased
22

3+
# 3.0.0
4+
- **[BREAKING CHANGE]:** Upgrade MSRV to 1.80 and remove the then unnecessary lazy_static dependency.
5+
36
# 2.2.0
47
- 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.
58
- Changes to `ColoredString`:

Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
[package]
22
name = "colored"
33
description = "The most simple way to add colors in your terminal"
4-
version = "2.2.0"
4+
version = "3.0.0"
55
edition = "2021"
66
authors = ["Thomas Wickham <[email protected]>"]
77
license = "MPL-2.0"
88
homepage = "https://github.com/mackwic/colored"
99
repository = "https://github.com/mackwic/colored"
1010
readme = "README.md"
1111
keywords = ["color", "string", "term", "ansi_term", "term-painter"]
12-
rust-version = "1.70"
12+
rust-version = "1.80"
1313

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

18-
[dependencies]
19-
lazy_static = "1"
2018

2119
[target.'cfg(windows)'.dependencies.windows-sys]
2220
version = ">=0.48,<=0.59"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ providing a reference implementation, which greatly helped making this crate
142142
output correct strings.
143143

144144
## Minimum Supported Rust Version (MSRV)
145-
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`.
145+
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`.
146146

147147
## License
148148

src/control.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::default::Default;
44
use std::env;
55
use std::io::{self, IsTerminal};
66
use std::sync::atomic::{AtomicBool, Ordering};
7+
use std::sync::LazyLock;
78

89
/// Sets a flag to the console to use a virtual terminal environment.
910
///
@@ -78,10 +79,8 @@ pub fn unset_override() {
7879
SHOULD_COLORIZE.unset_override();
7980
}
8081

81-
lazy_static! {
8282
/// The persistent [`ShouldColorize`].
83-
pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
84-
}
83+
pub static SHOULD_COLORIZE: LazyLock<ShouldColorize> = LazyLock::new(ShouldColorize::from_env);
8584

8685
impl Default for ShouldColorize {
8786
fn default() -> ShouldColorize {

src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
//! modify them.
3030
#![warn(missing_docs)]
3131

32-
#[macro_use]
33-
extern crate lazy_static;
34-
3532
#[cfg(test)]
3633
extern crate rspec;
3734

0 commit comments

Comments
 (0)