Rust Digger: 47,764 (32.92%) of the crates include a Cargo.lock file

Date: 2024.05.08

Should a crate include a Cargo.lock file?

I think the general idea is that executables should include Cargo.lock but libraries should not, but the goal here is to present the statistics collected by the Rust Digger as to what people actually do.

name value percentage
Total 145,087 100%%
Crates with Cargo.lock file 47,764 32.92%
Crates with Cargo.lock file and with src/main.rs file 27,484 18.94%
Crates with Cargo.lock file but without src/main.rs file 20,280 13.97%
Crates without Cargo.lock file 97,323 67.07%
Crates without Cargo.lock but with src/main.rs file 3,115 2.14%
Crates without Cargo.lock and without src/main.rs file 94,208 64.93%

This data is collected after downloading and unzipping the released crates from Crates.io One serious caveat is that a crate does not need to have a main.rs file in order to be executable. One can also map files to be the binary of a crate using the [[bin]] field. The Rust-Digger does just that, but as of today it does not take this information in account.

The above is a snapshot of the data as we have today. The up-to-date data can be found on the Stats pages.

Sponsoring

If you like the work that is being done on the Rust Digger project, please consider financially supporting it to at offset the incurred expenses.