build(deps): migrate usages of once_cell crate to standard library equivalents#8030
Merged
likhinbopanna merged 5 commits intomainfrom May 19, 2025
Merged
build(deps): migrate usages of once_cell crate to standard library equivalents#8030likhinbopanna merged 5 commits intomainfrom
once_cell crate to standard library equivalents#8030likhinbopanna merged 5 commits intomainfrom
Conversation
jarnura
approved these changes
May 15, 2025
ThisIsMani
approved these changes
May 16, 2025
tsdk02
approved these changes
May 16, 2025
ShankarSinghC
approved these changes
May 16, 2025
pixincreate
added a commit
that referenced
this pull request
May 20, 2025
…ss-typos * 'main' of github.com:juspay/hyperswitch: chore(version): 2025.05.20.0 feat(core): add all_keys_required in confirm and psync payload (#7998) fix(connector): [CASHTOCODE] Added supported countries and currencies (#8060) feat(connector): [CYBERSOURCE] add SEK currency for cybersource (#8048) build(deps): migrate usages of `once_cell` crate to standard library equivalents (#8030) feat(core): [Network Tokenization] pre network tokenization (#6873) feat(router): add open router integration for debit routing (#7907) chore(cypress): Update creds for stripe (#8069) chore(version): 2025.05.19.0
iemyashasvi
pushed a commit
that referenced
this pull request
May 22, 2025
…equivalents (#8030) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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.
Type of Change
Description
This PR updates the usages of the
once_cellcrate and its types with their standard library equivalents. This PR replaces:once_cell::sync::OnceCellwithstd::sync::OnceLock.once_cell::sync::Lazywithstd::sync::LazyLock.However, this is not a complete migration, since
once_cell::sync::OnceCell::get_or_try_init()cannot be replaced withstd::sync::OnceLock::get_or_try_init()as it is not available in the stable toolchain yet, as of Rust 1.86. Due to this reason,once_cellis still kept as a dependency in thecommon_utils,external_servicesandroutercrates, only where theget_or_try_init()method is being used.P.S.: This code was mostly written by AI, which I've also reviewed along the way.
Motivation and Context
This PR just replaces usages of one of our dependencies to the standard library equivalents.
How did you test it?
Performed sanity testing via Postman. The expected result is that there are no behavior changes due to this PR.
I have run unit tests on the
euclidandcommon_utilscrates, all of them (from these two crates) passed. Some of these unit tests make use of the static variables that were migrated in this PR:hyperswitch/crates/common_utils/src/validation.rs
Lines 111 to 120 in 5fd6df7
EMAIL_REGEXstatic variable.hyperswitch/crates/euclid/src/dssa/analyzer.rs
Lines 258 to 377 in 5fd6df7
analyzewithout providing a specific graph, thus usingANALYSIS_GRAPH.Screenshot of unit test run:
I have confirmed that cache system works correctly by adding a log line in case of in-memory cache hits (this log line was added only for testing and is not included in the PR). The in-memory caches also make use of static variables and
LazyLock, so their correct functioning indicates that the migration hasn't broken the cache system.Checklist
cargo +nightly fmt --allcargo clippy