Skip to content

chore(lazy_static): replace lazy_static with LazyLock #660

Merged
14 commits merged intonear:mainfrom
hackpk:fix-LazyLock
Jul 31, 2025
Merged

chore(lazy_static): replace lazy_static with LazyLock #660
14 commits merged intonear:mainfrom
hackpk:fix-LazyLock

Conversation

@hackpk
Copy link
Copy Markdown
Contributor

@hackpk hackpk commented Jul 16, 2025

Fix #519

  1. Replaced all the lazy_static with LazyLock.
  2. Removed lazy_static from cargo.toml
  3. Removed unwanted changes.

@netrome Please review. Thanks for helping, and apologies for the unwanted changes.

@netrome
Copy link
Copy Markdown
Collaborator

netrome commented Jul 16, 2025

Thank you @hackpk - you need to rebase on latest main though since there are some conflicts.

@hackpk hackpk changed the title Fix lazy lock and removed the unwanted changes fix: replace lazy_static with LazyLock and removed the unwanted changes Jul 16, 2025
@hackpk hackpk changed the title fix: replace lazy_static with LazyLock and removed the unwanted changes fix: replace lazy_static with LazyLock Jul 16, 2025
@hackpk hackpk changed the title fix: replace lazy_static with LazyLock fix(lazy_static): replace lazy_static with LazyLock Jul 16, 2025
@hackpk hackpk requested a review from netrome July 16, 2025 15:43
@netrome
Copy link
Copy Markdown
Collaborator

netrome commented Jul 21, 2025

Hey! How come you reverted the removal of lazy_lock from Cargo.toml?

@hackpk
Copy link
Copy Markdown
Contributor Author

hackpk commented Jul 22, 2025

Hi @netrome, it got removed while reverting made the changes again please check? Can you please be my mentor? I want be better at this ?

@netrome
Copy link
Copy Markdown
Collaborator

netrome commented Jul 22, 2025

Okay looks better now but formatting seems off. Did you run cargo fmt?

@netrome
Copy link
Copy Markdown
Collaborator

netrome commented Jul 22, 2025

Can you please be my mentor? I want be better at this?

I can help with PR comments, but don't have capacity to provide any fully-fledged mentorship right now. I know this type of external contribution can be hard, but cannot help you more unfortunately.

@hackpk
Copy link
Copy Markdown
Contributor Author

hackpk commented Jul 23, 2025

@netrome that's okay thanks btw and yes ran fmt but again after reverting I think I missed I will run it again thanks for your patience though

@netrome
Copy link
Copy Markdown
Collaborator

netrome commented Jul 23, 2025

@netrome that's okay thanks btw and yes ran fmt but again after reverting I think I missed I will run it again thanks for your patience though

No worries. There's been a new metric added on master though, so you'll need to rebase on latest master (or merge) and update the PR to include the new metric as well.

@kevindeforth kevindeforth changed the title fix(lazy_static): replace lazy_static with LazyLock chore(lazy_static): replace lazy_static with LazyLock Jul 25, 2025
Comment thread node/src/metrics.rs
Comment on lines +152 to +154
#[allow(dead_code)]
pub static MPC_ACCESS_KEY_NONCE: LazyLock<prometheus::IntGauge> = LazyLock::new(|| {
prometheus::register_int_gauge!(
Copy link
Copy Markdown
Contributor

@gilcu3 gilcu3 Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a complaint from clippy here, it seems that we were not using that function and that was only uncovered by this change.

@gilcu3
Copy link
Copy Markdown
Contributor

gilcu3 commented Jul 31, 2025

@hackpk Thank you very much for your contribution. I took the freedom to make a small update on this PR so that it can be merged as soon as possible.

@gilcu3 gilcu3 requested a review from kevindeforth July 31, 2025 15:43
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ghost ghost added this pull request to the merge queue Jul 31, 2025
Merged via the queue into near:main with commit b7beb48 Jul 31, 2025
5 checks passed
@hackpk
Copy link
Copy Markdown
Contributor Author

hackpk commented Aug 1, 2025

@near-bookrock thank you

This pull request was closed.
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.

[Task] Remove usage of lazy_static in favor of std::sync::LazyLock

3 participants