Skip to content

Replace lazy_static with once_cell#169

Merged
iwillspeak merged 1 commit intorust-onig:mainfrom
artichoke:lopopolo/once_cell
Aug 7, 2022
Merged

Replace lazy_static with once_cell#169
iwillspeak merged 1 commit intorust-onig:mainfrom
artichoke:lopopolo/once_cell

Conversation

@lopopolo
Copy link
Copy Markdown
Contributor

@lopopolo lopopolo commented Aug 6, 2022

onig is the only dependency left in Artichoke's Cargo.lock that uses lazy_static. It looks like most of the ecosystem has moved to once_cell. once_cell looks to be more actively maintained and is IMO nicer to read since there are no macros. Additionally, I believe once_cell is a nightly Rust API so it is conceivable that once these types land in std, once_cell will simply re-export types from std.

See also this related change in wasm-bindgen:

once_cell's MSRV is documented to be 1.36.0:

https://github.com/matklad/once_cell/blob/eda22cec55e9d37b16d408b7d0a5b396c7feb44c/CHANGELOG.md#151

As an aside, I noticed onig is using the 2015 edition. Do you have any interest in upgrading the code to 2018 edition? It's been a while since I've had to type extern crate 😅

`onig` is the only dependency left in Artichoke's `Cargo.lock` that uses
`lazy_static`. It looks like most of the ecosystem has moved to
`once_cell`. `once_cell` looks to be more actively maintained and is IMO
nicer to read since there are no macros.

See also this related change in `wasm-bindgen`:

- wasm-bindgen/wasm-bindgen#2962

`once_cell`'s MSRV is documented to be 1.36.0:

https://github.com/matklad/once_cell/blob/eda22cec55e9d37b16d408b7d0a5b396c7feb44c/CHANGELOG.md#151
@iwillspeak
Copy link
Copy Markdown
Collaborator

Nice. This, and the 2015 upgrade have both been on my radar. I’d happily accept another PR.

I’ll merge this now and look to get another release done this week.

@iwillspeak iwillspeak merged commit 8aaf0ec into rust-onig:main Aug 7, 2022
@lopopolo lopopolo deleted the lopopolo/once_cell branch August 7, 2022 19:01
@lopopolo
Copy link
Copy Markdown
Contributor Author

lopopolo commented Aug 7, 2022

Thanks @iwillspeak.

I put up a PR to upgrade both crates to 2018 edition here:

@iwillspeak
Copy link
Copy Markdown
Collaborator

Released as onig = "6.4.0" and onig_sys = "69.8.1".

lopopolo added a commit to artichoke/artichoke that referenced this pull request Aug 9, 2022
This removes `lazy_static` from Artichoke's `Cargo.lock` and is a
followup to rust-onig/rust-onig#169.

Update the minimum dependency constraints in `spinoso-regexp` and
`artichoke-backend` to 6.4.0.

```console
$ cargo update -p onig -p onig_sys
    Updating crates.io index
    Removing lazy_static v1.4.0
    Updating onig v6.3.2 -> v6.4.0
    Updating onig_sys v69.8.0 -> v69.8.1
```

Part of tracking issue #2052.
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.

2 participants