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/ file 27,484 18.94%
Crates with Cargo.lock file but without src/ file 20,280 13.97%
Crates without Cargo.lock file 97,323 67.07%
Crates without Cargo.lock but with src/ file 3,115 2.14%
Crates without Cargo.lock and without src/ file 94,208 64.93%

This data is collected after downloading and unzipping the released crates from One serious caveat is that a crate does not need to have a 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.


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.