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 #604

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

tamaroning
Copy link
Contributor

Hello, I am glad to know that bear is being rewritten in Rust and it sounds interesting.
This patch removes uses of lazy_static since it is going to be deprecated (see rust-lang-nursery/lazy-static.rs#214). The std library now supports OnceCell and OnceLock as alternatives.

@rizsotto
Copy link
Owner

Hey @tamaroning , thanks for this PR. I was not aware of the lazy_static going to be deprecated. Good catch.

I like that idea to not depending another crate for this. But was looking to the LazyLock, which has similar semantic as lazy_static. I do not worry much that the 1.80 version is very recent and might be not wildly recognized yet... What do you think? Could you update the PR to use LazyLock?

@tamaroning
Copy link
Contributor Author

I did not know about LazyLock since it was added to the standard library very recently.
As you pointed out, LazyLock is preferable to OnceLock because it is closer to the syntax of lazy_static.

@tamaroning
Copy link
Contributor Author

fixed

@rizsotto rizsotto merged commit f856ccf into rizsotto:master Nov 10, 2024
17 checks passed
@rizsotto
Copy link
Owner

Thanks @tamaroning , fantastic speed! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants