colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !
Mozilla Public License 2.0
1.68k stars 82 forks source link

Removes `lazy_static` in favor of OnceLock. #170

Open Dygear opened 4 months ago

Dygear commented 4 months ago

The goal here was simply to remove lazy_static in favor of the the standard lib functions that replaced it. This is the smallest number of code changes that I could create to make that happen. I have tested this in my own project and it works as it did before.

spenserblack commented 4 months ago

Because SHOULD_COLORIZE is public, and the usage now requires calling get_or_init, I believe this counts as a breaking change.

Perhaps until the API from once_cell is fully stabilized as part of the standard library (https://github.com/rust-lang/rust/pull/121377) once_cell::sync::Lazy from the once_cell crate can be used.