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 OnceLock #164

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Conversation

xTachyon
Copy link

Solves #163

This is technically a breaking change because SHOULD_COLORIZE used to be public a static var, and now it's a function.

If this is not acceptable, the other variant would be to use the once_cell crate which provides Lazy which is more similar to how lazy_static was working. This API is unstable in std at the moment.

@kurtlawrence kurtlawrence added the breaking Will need a major version bump label Jan 15, 2024
src/control.rs Outdated
/// The persistent [`ShouldColorize`].
pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
pub fn should_colorize_data() -> &'static ShouldColorize {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename as should_colorize_global? or get_should_colorize?

@kurtlawrence kurtlawrence changed the base branch from master to v3 January 17, 2024 06:19
Copy link
Collaborator

@kurtlawrence kurtlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a changelog entry under v3

@kurtlawrence kurtlawrence changed the base branch from v3 to master January 17, 2024 06:19
@kurtlawrence kurtlawrence changed the base branch from master to v3 January 17, 2024 10:08
@kurtlawrence kurtlawrence merged commit f04bcae into colored-rs:v3 Jan 17, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Will need a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants