Remove `once_cell` dep by replacing `once_cell::sync::OnceCell` with `std::sync::OnceLock`
https://doc.rust-lang.org/std/sync/struct.OnceLock.html was introduced in rust 1.70.0 which falls within this projects MSRV of 1.70.0 (according to the github actions config) As such we can just replace the usage of OnceCell with OnceLock to remove the once_cell dependency.
There were some tests using once_cell::sync::Lazy in what appears to be an attempt to prevent race conditions in concurrently running tests.
However, this does not help as I still observed test failures locally and needed to set --test-threads 1. (In fact CI is setup to run --test-threads 1 anyway)
So I opted to just remove this usage entirely.
If the usage in tests was important, I am happy to do one of:
- use serial_test instead.
- restore the original functionality and set once_cell as a dev-dependency.
- restore the original functionality by using https://doc.rust-lang.org/std/sync/struct.LazyLock.html (requires bumping msrv to 1.80.0)
👋🏻
I like the idea to switch to serial_test to serialize the tests, since it's cumbersome to have to remember to use --test-threads 1.
I enabled serial_test for every test. It could probably be left off for some tests, but IMO better to keep it everywhere, otherwise its easy to forget when its truly needed, and its not like the test suite takes a long time to run.
https://github.com/metrics-rs/quanta/pull/115 should fix the existing CI failures.