| Crates.io | cargo-unlock |
| lib.rs | cargo-unlock |
| version | 1.0.12 |
| created_at | 2022-07-01 11:45:22.834247+00 |
| updated_at | 2025-07-12 08:01:21.011192+00 |
| description | Remove Cargo.lock lockfile |
| homepage | |
| repository | https://github.com/dtolnay/cargo-unlock |
| max_upload_size | |
| id | 617096 |
| size | 32,077 |
New Cargo versions sometimes write out a lockfile that triggers parse failures in old Cargo versions.
$ cargo +1.41.0 check
...
Finished dev [unoptimized + debuginfo] target(s) in 0.91s
$ cargo +1.37.0 check
error: failed to parse lock file at: /git/testing/Cargo.lock
Caused by:
invalid serialized PackageId for key `package.dependencies`
The cargo unlock subcommand simply deletes the offending lockfile so that the
old Cargo can proceed. Install by running cargo install cargo-unlock.
rm Cargo.lockcargo unlock has three advantages:
It still works if run from a workspace member, where the lockfile would be located at the workspace root rather than the current directory.
It works if run from a subdirectory of a crate rather than the crate root.
If like me you use
export FIGNORE=argo.lock
in your shell so that all autocompletes prefer Cargo.toml over Cargo.lock,
this is easier to type.