- Home
- Mutation Testing Tools
- cargo-mutants
cargo-mutants
What it is
cargo-mutants is a free, open-source mutation testing tool for Rust projects. It makes candidate code changes and checks whether the test suite detects them, helping identify functions that may not be adequately tested. Run `cargo mutants` in a Rust source directory to begin; the project says no source-tree changes or other setup are needed before installation and use. Useful results depend on reliable, non-flaky tests running under `cargo test` or `cargo nextest`. Mutation types include function-body value replacement, binary-operator replacement, unary-operator deletion, match-arm deletion, match-guard replacement, and struct-literal field deletion. Runs support parallel execution and incremental analysis, with reports for surviving mutants and a mutation quality gate. Configuration can be kept in `.cargo/mutants.toml`; users can skip items with an attribute or exclude selected mutations by pattern. The manual documents CI workflows, including GitHub Actions examples. Cross-compilation is not supported, so the Rust source tree must build for the host platform; build systems other than Cargo are also unsupported. The project is MIT licensed and supplied without warranty.
For and against
For
- Runs without source-tree changes or additional setup.
- Supports incremental analysis and parallel execution.
- Reports surviving mutants and offers a mutation quality gate.
- Documents CI workflows, including GitHub Actions.
Against
- Cross-compilation is not supported.
- Build systems other than Cargo are unsupported.
- Useful results depend on reliable, non-flaky tests.
- The project is provided without warranty.
The verdict
cargo-mutants provides configurable mutation checks for Rust projects and documents ways to use them in CI. It fits Cargo-based projects that build for the host platform and have reliable tests.
Who it suits
cargo-mutants suits Rust developers who want to check whether their tests catch selected code changes. It requires a dependable test suite that runs through `cargo test` or `cargo nextest`.
On the record
- Build system limit
- Build tools other than Cargo are not currently supported.mutants.rs · read 5 Oct 2026
- CI
- The manual includes instructions and examples for testing mutants in CI, including incremental pull request testing and full development branch testing.github.com · read 4 Oct 2026
- CI integration
- The project documents GitHub Actions workflows and says cargo-mutants emits structured annotations when it detects that it is running in an action.mutants.rs · read 5 Oct 2026
- Compatibility limit
- Cross-compilation is not currently supported, so the Rust tree must be buildable for the host platform.mutants.rs · read 4 Oct 2026
- Configuration
- Options can be configured in `.cargo/mutants.toml`, and the guide recommends checking that file into the source tree.mutants.rs · read 5 Oct 2026
- Dismiss findings
- Users can dismiss mutants with a `#[mutants::skip]` attribute or a configuration file.mutants.rs · read 4 Oct 2026
- Exclude mutations
- Items can be skipped with `#[mutants::skip]`, and specific mutations can be excluded with `#[mutants::exclude_re("pattern")]`.mutants.rs · read 5 Oct 2026
- Getting started
- You can run `cargo mutants` in a Rust source directory to identify functions that may be inadequately tested.mutants.rs · read 5 Oct 2026
- How to run
- Run `cargo mutants` in a Rust source directory to identify functions that may be inadequately tested.mutants.rs · read 4 Oct 2026
- Installation
- The guide documents installation with `cargo install --locked cargo-mutants`, `cargo binstall`, or binaries from GitHub releases.mutants.rs · read 5 Oct 2026
- License and warranty
- The project is MIT licensed and provided as-is with no warranty of any kind.github.com · read 4 Oct 2026
- Maintenance
- The repository describes the project as semi-actively maintained in spare time as of August 2026, with bug reports and pull requests read at higher latency.github.com · read 4 Oct 2026
- Platform limit
- Cross-compilation is not currently supported; the source tree must be buildable for the host platform.mutants.rs · read 5 Oct 2026
- Purpose
- cargo-mutants is a mutation testing tool for Rust that finds places where bugs could be inserted without causing tests to fail.mutants.rs · read 5 Oct 2026
- Reproducibility
- Results should be reproducible when the build and test suite are deterministic.mutants.rs · read 4 Oct 2026
- Runtime
- A run’s duration depends roughly on the number of viable mutations multiplied by the time to run the test suite for each mutation.mutants.rs · read 5 Oct 2026
- Rust versions
- Building cargo-mutants requires a reasonably recent stable, nightly, or beta Rust toolchain.mutants.rs · read 4 Oct 2026
- Setup
- The tool requires no changes to the source tree or other setup before installation and use.mutants.rs · read 4 Oct 2026