frewsxcv / rust-crates-index

Rust library for retrieving and interacting with the crates.io index
https://docs.rs/crates-index/
Apache License 2.0
72 stars 37 forks source link

Start using `smol_str` again to avoid MPL 2.0 license of `smartstring` #90

Closed Enselic closed 1 year ago

Enselic commented 1 year ago

Hi and thank you for this very useful project :pray:

I noticed that in https://github.com/frewsxcv/rust-crates-index/commit/7e945b37dc94a442438bd1d8c2da9ee81ac3f0ad, smol_str was replaced by smartstring for MSRV reasons.

What is the MSRV for this project? Is it higher than 1.45? If so, we should be able to go back to smol_str. I can run cargo test on smol_str with 1.46, but not 1.45. So I think the effective MSRV of smol_str 0.1.23 is 1.46.

The downside of smartstring is that it is licensed under MPL 2.0, which has a copyleft flavor to it, which some can find concerning. smol_str is MIT OR APACHE-2.0.

Inte: The officiell MSRV policy of smol_str is "latest stable". Maybe that is a problem. Another option to this PR could be to add a feature where smol_str OR smartstring can be chosen.

Thank you in advance for any guidance or pointers.

kornelski commented 1 year ago

That was only a temporary issue because 1.46 had a terrible performance regression. I don't support old Rust versions otherwise, and crates-index won't work with <1.57.

However, I don't think MPL is a problem. AFAIK it's not viral, and you don't really need to care about it unless you modify the smartstring crate.

I don't need smol_str's special handling of whitespace — spaces aren't even allowed in any of the strings I use it for, so smartstring's extra character of storage is a better trade-off.

Enselic commented 1 year ago

Thanks for the response.

After learning more about MPL 2.0 and pinging some users of my project, this indeed seems fine. Good point about smartstring having a technical advantage over smol_str for the uses-cases of crates-index, i.e. it is not only a matter of licensing.

Closing.

kornelski commented 1 year ago

smartstring turned out to be problematic: #92