Skip to content

misc: replace OnceLock with LazyLock#649

Merged
Serial-ATA merged 2 commits intoSerial-ATA:mainfrom
loxoron218:replace-oncelock-with-lazylock
Apr 24, 2026
Merged

misc: replace OnceLock with LazyLock#649
Serial-ATA merged 2 commits intoSerial-ATA:mainfrom
loxoron218:replace-oncelock-with-lazylock

Conversation

@loxoron218
Copy link
Copy Markdown
Contributor

I replaced std::sync::OnceLock with std::sync::LazyLock for static initializations in upgrade.rs, write/mod.rs, resolve.rs, and tag/item.rs to simplify lazy initialization logic and fix #441

  • lofty/src/tag/items/popularimeter.rs uses OnceLock with .set() and can't be converted to LazyLock without bigger API changes. That's why I left it :)

Replace `std::sync::OnceLock` with `std::sync::LazyLock` for static initializations in `upgrade.rs`, `write/mod.rs`, `resolve.rs`, and `tag/item.rs` to simplify lazy initialization logic.
Comment thread lofty/src/id3/v2/write/mod.rs Outdated
Comment thread lofty/src/resolve.rs Outdated
…ERS static

Replace the `custom_resolvers()` function with a global `CUSTOM_RESOLVERS`
`LazyLock` static to simplify access and align with the transition from
`OnceLock` to `LazyLock`. This also includes refactoring the CRC32 table
to use a static `LazyLock` instead of a function.
Copy link
Copy Markdown
Owner

@Serial-ATA Serial-ATA left a comment

Choose a reason for hiding this comment

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

Thanks!

@Serial-ATA Serial-ATA changed the title refactor(lofty): replace OnceLock with LazyLock misc: replace OnceLock with LazyLock Apr 24, 2026
@Serial-ATA Serial-ATA merged commit 5497a02 into Serial-ATA:main Apr 24, 2026
4 checks passed
@loxoron218 loxoron218 deleted the replace-oncelock-with-lazylock branch April 24, 2026 22:00
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.

Switch to std::sync::LazyLock

2 participants