Skip to content

refactor: replace lazy_static! with std::sync::LazyLock#7203

Open
vwinee21 wants to merge 1 commit into
stacks-network:masterfrom
vwinee21:fix/replace-lazy-static-with-lazy-lock
Open

refactor: replace lazy_static! with std::sync::LazyLock#7203
vwinee21 wants to merge 1 commit into
stacks-network:masterfrom
vwinee21:fix/replace-lazy-static-with-lazy-lock

Conversation

@vwinee21

Copy link
Copy Markdown

Closes #5035

Summary

Replace all usages of the lazy_static crate with std::sync::LazyLock from the standard library, which was stabilized in Rust 1.80.

Changes

  • Removed lazy_static dependency from 8 Cargo.toml files
  • Added use std::sync::LazyLock imports where needed
  • No behavior changes — purely mechanical substitution

Why

  • Eliminates an external dependency in favor of stdlib
  • LazyLock is thread-safe, drop-in equivalent to lazy_static's static ref pattern
  • Cleaner syntax, no macro magic required

Closes stacks-network#5035

Replace all usages of the lazy_static crate with std::sync::LazyLock
from the standard library, stabilized in Rust 1.80.

- Remove lazy_static dependency from 8 Cargo.toml files
- Convert 31 lazy_static! blocks across 24 .rs files to LazyLock
- Add use std::sync::LazyLock imports where needed
- No behavior changes — purely mechanical substitution
@CLAassistant

CLAassistant commented May 13, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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 this pull request may close these issues.

Replace lazy_static! with std::cell::LazyCell

2 participants