Tool to recursively find Cargo.toml files and update the rust-version value to the latest installed Rust.

Files
README.md

rust-version-updater #

A fast CLI tool written in Zig that recursively updates rust-version fields in Cargo.toml files to match your currently installed Rust version.

Why? #

Rust's rust-version field in Cargo.toml specifies the minimum Rust version required to build a crate. Keeping this field updated across multiple crates in a workspace or monorepo can be tedious. This tool automates that process.

Features #

  • Recursively scans directories for Cargo.toml files
  • Only updates versions that are older than your current rustc version
  • Skips workspace inheritance (rust-version = { workspace = true })
  • Dry-run mode to preview changes before applying
  • Single static binary with no runtime dependencies

Installation #

From source #

This project follows Zig master (currently 0.17.0-dev.607+456b2ec07):

zig build -Doptimize=ReleaseFast

The binary will be in zig-out/bin/rust-version-updater.

Usage #

# Update all Cargo.toml files in current directory tree
rust-version-updater

# Preview changes without modifying files
rust-version-updater --dry-run

# Show help
rust-version-updater --help

Example output #

Current Rust version: 1.84.0

src/foo/Cargo.toml: updated 1.70.0 -> 1.84.0
src/bar/Cargo.toml: skipped (version 1.84.0 is not older)
src/baz/Cargo.toml: skipped (non-semver value)

--- Summary ---
Files scanned: 3
Files updated: 1
Files skipped: 2
Errors: 0

License #

MIT