Skip to content

Use std::sync::OnceLock instead of once_cell#281

Merged
djc merged 2 commits intoconsole-rs:mainfrom
cuviper:oncelock
Mar 12, 2026
Merged

Use std::sync::OnceLock instead of once_cell#281
djc merged 2 commits intoconsole-rs:mainfrom
cuviper:oncelock

Conversation

@cuviper
Copy link
Contributor

@cuviper cuviper commented Mar 12, 2026

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.

`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.
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

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 djc merged commit 6bd8894 into console-rs:main Mar 12, 2026
20 checks passed
@djc
Copy link
Member

djc commented Mar 12, 2026

If you want a release, mind submitting a version bump PR?

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