How to care for finished rust items

A finished Rust item — a small binary, a library crate, or a personal tool — still needs care. Care means keeping it buildable, safe to run, and easy to restore. The routine below takes about 30–45 minutes a month for a hobby project, with a longer review every 6–8 weeks.

Treat “finished” as a maintenance state

Write a one-page care note: owner, purpose, exact toolchain, build command, run command, backup location, and next review date. Put a recurring calendar entry every 6–8 weeks. For a small hobby binary, reserve 30–45 minutes; for anything that accepts untrusted input, reserve 2 hours and review sooner. Include one sentence on what “working” means — for example, “prints a valid report for a sample file”. A finished item with no owner and no review date is already drifting.

Pin the toolchain and record the minimum version

Use a rust-toolchain.toml file with a fixed stable channel, for example 1.75.0, not “stable”. Add rust-version = "1.75" to Cargo.toml to state the minimum supported Rust version. Test the pinned toolchain and current stable before updating. Update no more than once every 6–8 weeks, except for a security fix, which should be applied within 72 hours. Avoid nightly unless a dependency requires it: nightly changes weekly and adds care work. Keep the pinned version in the care note so a rebuild in six months does not guess. If the item is a library, test the MSRV with the same command your users will run, not only a debug build.

Keep dependencies on a short leash

Run cargo update monthly, then read the Cargo.lock diff before accepting it. For a small hobby item, keep direct dependencies under 10 and remove unused ones. Commit Cargo.lock for binaries so builds are repeatable; for a library, follow the convention of the project that consumes it. Run a dependency audit weekly and patch a critical vulnerability within 24–48 hours. Upgrade one major version at a time, run tests, and keep the previous working lockfile until the new build has passed. If a dependency pulls in more than 20 transitive crates, check whether you actually need it.

Run a 20-minute release check

Before calling a change finished, run cargo fmt --check, cargo clippy -- -D warnings, and cargo test. Keep a hobby test suite under 2 minutes where possible. Add a smoke test that runs the binary with --help and one sample input, then checks exit code 0. Rebuild from a clean clone at least once per quarter; a build that only works in your existing target/ folder is not cared for. If the full check takes longer than 20 minutes, split it: fast checks before every change, slower checks weekly. A practical split is: fmt and clippy under 60 seconds, unit tests under 2 minutes, and the clean-clone build in the quarterly review.

Back up source and lockfile, not build output

Follow 3-2-1: three copies, two kinds of media, one off-site. Back up daily automatically and verify a restore weekly. Do not back up target/; it can easily reach 1–5 GB and is rebuilt from source. Keep one release archive per tagged version, including the lockfile and a note of the toolchain used. Encrypt backups that contain secrets and test the restore on a different machine. A backup you have never restored is only a hope.

Watch a running item with small checks

If the item runs as a service, add a health check every 5 minutes with a 5–10 second timeout, and alert after two consecutive failures. Watch disk at 80% and memory at 90%; rotate logs after 7–14 days. A hobby service can run on a small virtual server costing roughly $5–10 per month, but the checks matter more than the hosting tier. Use two alerts only: item down for 10 minutes, and disk above 80% for 1 hour; more alerts get ignored. Record the check commands in the care note so you can run them by hand during an incident.

Document the routine future-you will need

Keep a README with build, run, test, backup, and restore commands, plus required environment variables. Use semantic versioning and tag releases; write a changelog entry every release. Add a “last verified” date and update it after each review. A useful rule: if restoring the item takes more than 30 minutes from the README alone, the documentation needs care more than the code does. Store the care note beside the code, not in your head.

Diagnose the common failure: “it built last month, now it won’t”

Symptoms: cargo build fails with an unresolved dependency, an edition or compiler error, or tests that passed before now fail. Likely causes are an unpinned toolchain, a major dependency update, a stale or overwritten Cargo.lock, or an environment change such as a missing variable. Fix in this order: compare rustc --version with the pinned version; restore Cargo.lock from backup; update one dependency with cargo update -p; run cargo tree -d to find duplicate versions; then cargo clean and rebuild. Timebox the repair to 30 minutes, and revert to the last tagged release if it is not fixed. If a security advisory is the cause, do not spend the 30 minutes on a workaround: pin the last safe version and plan the patch. Prevent recurrence by pinning the toolchain and running the release check before every update.

FAQ

Do I need to update a finished Rust item if it still works?

Yes, if it has dependencies or handles untrusted input. Review every 6–8 weeks and apply critical security patches within 24–48 hours. An offline personal tool can often wait a quarter, but record that decision and the date.

Should I keep Cargo.lock for a library?

For a binary or application, commit it. For a library, follow the norm of its users; many libraries omit it from version control because downstream builds resolve their own graph. If in doubt, keep it for applications and test without it for libraries.

When should I retire a Rust item?

Retire when maintenance exceeds about 4 hours a month, a critical dependency is unmaintained, the pinned toolchain is more than 6 months out of support, or a security fix cannot be applied. Archive the source, lockfile, release notes, and restore instructions; remove secrets; keep the backup. A retired item still needs one final backup and a note that it is unsupported.