various crates: Initial migration from [`once_cell::sync::OnceCell`] to [`std::sync::OnceLock`]

Changes

tor-geoip:

tor-netdoc:

tor-log-ratelim:

tor-events:

  • [once_cell::sync::OnceCell] has been replaced by [std::sync::OnceLock].

tor-geoip:

tor-events:

  • The once_cell crate has been removed as a dependency, as it is no longer needed.

tor-log-ratelim:

  • The old TODO referring to this has been removed.

tor-circmgr:

arti-client:

  • Added TODOs noting that the usage of [once_cell::sync::OnceCell] in these crates should be replaced by [std::sync::OnceLock] once any blocking issues are resolved (namely, the currently unstable once_cell_try, though there may be more).

For additional consideration:

  • /arti/crates/tor-hsservice/src/req.rs makes use of [once_cell::unsync::OnceCell], which could be replaced with [std::cell::OnceCell] in the future (also pending once_cell_try).

  • /arti/crates/tor-error/src/retriable.rs makes use of [once_cell::unsync::Lazy], which could be replaced with std::cell::LazyCell with MSRV >= 1.80.0.

  • Several locations make use of [once_cell::sync::Lazy], which could be replaced with std::sync::LazyLock with MSRV >= 1.80.0.

  • Aside from what has already been mentioned, it seems the last mention of the once_cell crate is in /arti/crates/tor-rpcbase/src/lib.rs. It isn't very clear to me what purpose it serves there, but it seems plausible the dependency could be completely removed in the future.


Let me know if you'd like TODOs for any of the additionally mentioned items.

/cc @nickm

Merge request reports

Loading