Maintain
FIXME review
Topic | Rust Crates |
---|---|
Code Formatting | cargo fmt formats your code to a consistent style. |
Linting | cargo clippy catches common code errors and style issues. |
Dependency Management | cargo tree displays your dependency tree to help you understand your project's dependencies. cargo outdated checks for outdated dependencies. cargo audit checks for crates with known security vulnerabilities. |
Documentation Generation | cargo doc generates documentation from your code. cargo deadlinks finds broken links in your documentation. |
Testing | cargo test runs your unit and integration tests. |
Benchmarking | cargo bench runs your benchmarks. |
Code Coverage | cargo tarpaulin runs code coverage analysis. |
Refactoring | Often IDE-driven, but some tools exist: cargo-expand ⮳ expands macros, which can be helpful for understanding code and refactoring. |
Version Management | cargo-bump helps to automate version updates in your Cargo.toml. |
Lint Your Crate API Changes for Semver Violations
cargo-semver-checks
⮳ scans your Rust crate for semver
⮳ violations.
# If you Already Use `cargo-binstall` for Faster Tool installations:
$ cargo binstall cargo-semver-checks
# Otherwise:
$ cargo install cargo-semver-checks --locked
# Lint a new Release for SemVer Breakage Before `cargo publish`:
$ cargo semver-checks
Manage the cargo
Cache
cargo cache
⮳ manages the cargo
⮳ cache ($CARGO_HOME or ~/.cargo/), shows sizes and removes directories selectively.
cargo expand
cargo expand
is a wrapper around rustc -Zunpretty=expanded
. Shows the result of macro expansion and #[derive]
expansion.
cargo hack
cargo hack
is a cargo
⮳ subcommand to provide various options useful for testing and continuous integration.