Use std::sync::OnceLock instead of once_cell#281
Merged
djc merged 2 commits intoconsole-rs:mainfrom Mar 12, 2026
Merged
Conversation
`OnceLock` was stabilized in Rust 1.70, so this is usable in `console` now that its MSRV is 1.71, and thus `once_cell` can be dropped. This would be closer to the original code if we could use 1.80's `LazyLock`, but function wrappers here can still achieve a similar kind of abstraction around the lazy initialization.
djc
reviewed
Mar 12, 2026
Member
djc
left a comment
There was a problem hiding this comment.
Thanks!
Hmm, I do kind of hate the OnceLock API compared to LazyLock. Oh well, I guess we'll get to it in a year or so.
djc
approved these changes
Mar 12, 2026
Member
|
If you want a release, mind submitting a version bump PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OnceLockwas stabilized in Rust 1.70, so this is usable inconsolenow that its MSRV is 1.71, and thus
once_cellcan be dropped.This would be closer to the original code if we could use 1.80's
LazyLock, but function wrappers here can still achieve a similar kindof abstraction around the lazy initialization.