chore: replace lazy_static with std LazyLock#5028
Open
onx2 wants to merge 2 commits into
Open
Conversation
onx2
commented
May 15, 2026
Comment on lines
+140
to
+141
| // Eventually we will want to add more required claims. | ||
| const REQUIRED_CLAIMS: [&str; 2] = ["sub", "iss"]; |
Contributor
Author
There was a problem hiding this comment.
This seemed like it should have been const, can change to static though if I'm missing something.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Replaces direct
lazy_staticusage with standard library primitives.Most usages were replaced with
std::sync::LazyLock. One simple static list of required JWT claims was replaced with a plain static array, and an unused lazy regex in the benchmark summarizer was removed.This also removes direct
lazy_staticdependencies from the workspace crates that no longer use it.Various other deps still use it but the general ecosystem vibe is to use
stdinstead:colored v2.2.0-> chore: remove lazy_static in favor of std colored-rs/colored#231prometheus v0.14.0-> Remove lazy_static dependency tikv/rust-prometheus#556sharded-slab v0.1.7-> (Remove dependency on lazy_static hawkw/sharded-slab#112, Another attempt at removing lazy_static hawkw/sharded-slab#111)tracing-flame v0.2.0-> transitive throughsharded-slabwhich has PRs already.This is primarily dependency hygiene rather than a performance optimization. Since this codebase targets a modern Rust version, direct
lazy_staticusage can be replaced with standard library primitives, reducing maintenance burden and one direct dependency.API and ABI breaking changes
None
Expected complexity level and risk
1 - trivial, matching behavior in std
Testing
Ran:
cargo fmt --all --manifest-path SpacetimeDB/Cargo.tomlcargo check --manifest-path SpacetimeDB/Cargo.toml -p spacetimedb-bench --benchescargo check --manifest-path SpacetimeDB/Cargo.toml -p spacetimedb-standaloneAlso verified there are no remaining direct
lazy_staticusages in Rust source files.