Freedom251 › Mutation Testing Tools
cargo-mutants

What cargo-mutants is
cargo-mutants is a Rust mutation testing tool that checks whether tests catch deliberately introduced code changes. Run `cargo mutants` in a Rust source directory to identify functions that may be inadequately tested. 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`. It supports incremental analysis, parallel execution, surviving-mutant reports, and mutation quality gates. Documented mutation operators include function-body value replacement, binary-operator replacement, unary-operator deletion, match-arm deletion, match-guard replacement, and struct-literal field deletion. Options can be set in `.cargo/mutants.toml`; mutations can also be skipped or excluded. The manual includes CI examples, including GitHub Actions. Cross-compilation and build systems other than Cargo are not supported, and the source tree must build for the host platform. The tool is MIT licensed and provided without warranty.
Who it suits
It suits Rust developers who want to find gaps in tests and can run reliable tests through Cargo or nextest. Teams using CI can draw on the documented workflows and incremental pull request testing guidance.
What it does well
- Finds code changes that tests may fail to catch.
- Supports incremental analysis and parallel execution.
- Can report surviving mutants and serve as a quality gate.
- Configuration can be stored in `.cargo/mutants.toml`.
- Documents CI workflows, including GitHub Actions.
What to know first
- Cross-compilation is not supported.
- Build systems other than Cargo are unsupported.
- Useful results depend on reliable, non-flaky tests.
- Provided as-is with no warranty.
Limits
The tool requires the Rust source tree to build for the host platform, and supports Cargo rather than other build systems. Useful results depend on reliable, non-flaky tests.
Getting started
- Open https://mutants.rs/.
- Install with `cargo install --locked cargo-mutants`, `cargo binstall`, or a binary from GitHub releases.
- Use a reasonably recent stable, nightly, or beta Rust toolchain to build it.
- Run `cargo mutants` in a Rust source directory.
- Use tests under `cargo test` or `cargo nextest` for useful results.
Verdict
cargo-mutants offers Rust-focused mutation analysis with configuration, reporting, and CI guidance. Its value depends on dependable tests, and projects must build for the host platform using Cargo.
Questions
Is cargo-mutants free?
Yes. It is free and open source under the MIT license.
Which languages and test runners does it support?
It supports Rust projects with tests run through `cargo test` or `cargo nextest`.
How do I start using it?
Install it with a documented installation route, then run `cargo mutants` in a Rust source directory.
Can it run in CI?
Yes. The project documents CI workflows, including GitHub Actions examples and incremental pull-request testing.
Does it support cross-compilation?
No. The Rust tree must be buildable for the host platform.
How can I exclude a mutation?
You can skip items with `#[mutants::skip]` or exclude specific mutations with `#[mutants::exclude_re("pattern")]`.
Facts from cargo-mutants's own pages
- Build system limit
- Build tools other than Cargo are not currently supported. · mutants.rs, 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, 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, 5 Oct 2026
- Compatibility limit
- Cross-compilation is not currently supported, so the Rust tree must be buildable for the host platform. · mutants.rs, 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, 5 Oct 2026
- Dismiss findings
- Users can dismiss mutants with a `#[mutants::skip]` attribute or a configuration file. · mutants.rs, 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, 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, 5 Oct 2026
- How to run
- Run `cargo mutants` in a Rust source directory to identify functions that may be inadequately tested. · mutants.rs, 4 Oct 2026
- Installation
- The guide documents installation with `cargo install --locked cargo-mutants`, `cargo binstall`, or binaries from GitHub releases. · mutants.rs, 5 Oct 2026
- License and warranty
- The project is MIT licensed and provided as-is with no warranty of any kind. · github.com, 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, 4 Oct 2026
- Platform limit
- Cross-compilation is not currently supported; the source tree must be buildable for the host platform. · mutants.rs, 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, 5 Oct 2026
- Reproducibility
- Results should be reproducible when the build and test suite are deterministic. · mutants.rs, 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, 5 Oct 2026
- Rust versions
- Building cargo-mutants requires a reasonably recent stable, nightly, or beta Rust toolchain. · mutants.rs, 4 Oct 2026
- Setup
- The tool requires no changes to the source tree or other setup before installation and use. · mutants.rs, 4 Oct 2026
- Support
- The project README invites users to share experience reports in GitHub Discussions and sponsor development. · github.com, 5 Oct 2026
- Test requirements
- Useful results require reliable, non-flaky tests that run under `cargo test` or `cargo nextest`. · mutants.rs, 5 Oct 2026
- Test runners
- Useful results require reliable, non-flaky tests that run under `cargo test` or `cargo nextest`. · mutants.rs, 4 Oct 2026
Where cargo-mutants stands on Freedom251
- Mutation Testing Tools#12 of 25