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 once_cell #3828

Closed
jplatte opened this issue Jun 14, 2022 · 3 comments · Fixed by #3829
Closed

Replace lazy_static with once_cell #3828

jplatte opened this issue Jun 14, 2022 · 3 comments · Fixed by #3829

Comments

@jplatte
Copy link
Contributor

jplatte commented Jun 14, 2022

Many other projects have switched from lazy_static to once_cell because it offers a macro-free solution to the same problem (with the only caveat being missing no_std support which I'm pretty sure is irrelevant for clap). Would you be open to a PR that does the same thing here?

In the future, the once_cell dependency can likely be removed in favor of the same functionality in std.

@matklad
Copy link
Contributor

matklad commented Jun 14, 2022

with the only caveat being missing no_std support

FWIW, the subset of the API which can be reasonably implented in no-std is available:

https://docs.rs/once_cell/latest/once_cell/race/index.html

The "I can't notify OS that I am blocked, so I am just going to spin" part is indeed not available, but I'd argue that is a feature :-)

epage added a commit to epage/clap that referenced this issue Jun 14, 2022
Though this is changing an API item we export, we do not consider this a
breaking change because
- This was an implementation detail of the macros and people shouldn't be using it directly
- The `macro_rules` macro is coupled to `clap` because they are in the
  same crate
- The derive macro is coupled to `clap` because `clap` declares a
  `=x.y.z` dependency on `clap_derive

Fixes clap-rs#3828
@epage
Copy link
Member

epage commented Jun 14, 2022

Huh, I thought there was a reason why I had kept it but not seeing a reason to. #3829 will switch us over.

@jplatte
Copy link
Contributor Author

jplatte commented Jun 14, 2022

The "I can't notify OS that I am blocked, so I am just going to spin" part is indeed not available, but I'd argue that is a feature :-)

Hmm, I think that's what tracing wants.. (tokio-rs/tracing#1165 (comment)) 😕

I guess that also means matklad/once_cell#61 should be closed? In any case that issue is probably the place to continue this conversation.

sunfishcode added a commit to sunfishcode/openvino-rs that referenced this issue Jul 2, 2022
The Rust ecosystem is generally migrating away from lazy_static to
once_cell, for example [here].

This patch updates openvino-sys from lazy_static to once_cell.

[here]: clap-rs/clap#3828
abrown pushed a commit to intel/openvino-rs that referenced this issue Jul 5, 2022
The Rust ecosystem is generally migrating away from lazy_static to
once_cell, for example [here].

This patch updates openvino-sys from lazy_static to once_cell.

[here]: clap-rs/clap#3828
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 a pull request may close this issue.

3 participants