-
-
Notifications
You must be signed in to change notification settings - Fork 31
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 dependency in chain crate with once_cell #220
Replace lazy_static dependency in chain crate with once_cell #220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this proposal! BTW it does not closes #213, since the idea was not to use any form of static and try to convert that into a constant expressions (I didn't wrote that in the description of the issue, sorry). It was not that lazy_static
is bad, it is just we would like to reduce the size of dependency tree - and "frequently updated" sounds a bit scary for a project that aims ossification (as a client-side-validated library).
Nevertheless this is a clear improvement over what we have now. Especially I like the part that once_cell
is going to become a part of the rust itself and with time we will be able to remove this from the dependencies.
Will merge once CI will finish running.
Sorry, it seems it requires reformatting + rebase on the master (according to the merge policy of the repo). Can you do it please? |
Codecov Report
@@ Coverage Diff @@
## master #220 +/- ##
========================================
+ Coverage 68.4% 70.0% +1.6%
========================================
Files 5 5
Lines 1273 1226 -47
========================================
- Hits 871 858 -13
+ Misses 402 368 -34
Continue to review full report at Codecov.
|
I updated the description to indicate this doesn't satisfy #213 . Next time I will get clarification. I will check the formatting and other issues. |
The formatting error should be fixed with the latest commit:
As for rebasing onto master, the output of rebase is |
aedfdec
to
0617fcc
Compare
I see what you mean now. I was pulling from the wrong remote. It should be cleanly rebased now. |
Addresses #213This PR replaces usage of the
lazy_static!
macro with theonce_cell::sync::Lazy
type. This accomplishes the same goals aslazy_static!
by lazily initializing global data.once_cell
has the following advantages overlazy_static
:once_cell
has seen more recent active developmentonce_cell
functionality is in the current nightly build of Rust - tracking issueOther comparisons between the two libraries