Update Cargo Dependencies
Update each dependency in the root Cargo.toml to its latest major version, one at a time, with
verification and individual commits. Then run cargo update for minor/patch updates.
Preconditions
Verify ALL of the following before starting. If any fails, stop and tell the user.
- Not on main:
git branch --show-currentmust not bemain. - Up to date with main:
git fetch origin main, thengit rev-parse HEADmust equalgit rev-parse origin/main. If not: AskUserQuestion Is this branch OK? - Clean working tree:
git status --porcelainmust produce no output. If not: AskUserQuestion commit before proceeding?
Step 1 — Cargo Update Before Major Bumps
Run cargo update, then cargo check, cargo build, and cargo test. Fix issues. If there are
changes, commit with the message run cargo update
Step 2 — Identify Major Version Bumps
Read the root Cargo.toml. For each crate under [dependencies] (skip [dev-dependencies]), run
cargo search <crate-name> --limit 1 to find the latest published version.
Major update rules:
0.xcrates: minor version is the major.0.3->0.4is major;0.3->0.3.5is not.>=1crates: only the major matters.1->2is major;1->1.5is not.
Print the list: <name>: <current> -> <latest-major>. If none, skip to Step 3.
Step 3 — Update Each Dependency
Process each major update sequentially. For each:
- Edit Cargo.toml — change the version to the new major using least-specific semver. Preserve features and other attributes.
cargo update— refresh Cargo.lock.- Verify — run
cargo check,cargo build,cargo testin order. If any step fails, read the errors and fix them. Repeat until all three pass. Don't give up after one attempt — breakage from major bumps is expected. Fix warnings in source code, not in test expectations. - Commit — stage all changes. Message format:
update <dep> from <old> to <new>using least-specific versions (e.g.update toml from 0.8 to 0.9).
Step 4 — Minor/Patch Updates
- Run
cargo update - If
Cargo.lockchanged (git diff --quiet Cargo.lock), commit it:run cargo update - If unchanged, tell the user.
Completion
Summarize: which deps got major updates (from/to), whether cargo update changed anything, total commits created.
Source: webern/cargo-readme — distributed by TomeVault.