Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- New: `--incremental` is accepted as an alias for `--iterate`.
- New: `#[mutants::exclude_re("pattern")]` attribute to exclude specific mutations by regex, without disabling all mutations on the function. The attribute can be placed on functions, `impl` blocks, `trait` blocks, modules, files, and on expressions that can carry an attribute (such as `match`, struct literals, call expressions, method calls, and unary expressions). Multiple patterns can be applied. Also supported within `cfg_attr`. Requires the [mutants](https://crates.io/crates/mutants) crate version `0.0.5` or later.
- Fixed: `#[mutants::skip]` (and `#[cfg_attr(..., mutants::skip)]`) is now honoured when placed on `const` and `static` items, including associated constants in `impl` and `trait` blocks. Previously the attribute was silently ignored on these items and operator mutants inside the initializer expression were still generated ([#508](https://github.com/sourcefrog/cargo-mutants/issues/508)).

Expand Down
2 changes: 1 addition & 1 deletion book/src/iterate.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ When you're working to improve test coverage in a tree, you might use a process

4. Repeat until everything is caught.

You can speed up this process by using the `--iterate` option. This tells cargo-mutants to skip mutants that were either caught or unviable in a previous run, and to accumulate the results.
You can speed up this process by using the `--iterate` option (also available as `--incremental`). This tells cargo-mutants to skip mutants that were either caught or unviable in a previous run, and to accumulate the results.

You can run repeatedly with `--iterate`, adding tests each time, until all the missed mutants are caught (or skipped.)

Expand Down
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ pub struct Args {
in_diff: Option<Utf8PathBuf>,

/// Skip mutants that were caught in previous runs.
#[arg(long, help_heading = "Filters")]
#[arg(long, visible_alias = "incremental", help_heading = "Filters")]
iterate: bool,

/// Only test mutants from these packages.
Expand Down Expand Up @@ -671,6 +671,12 @@ mod test {
println!("Error message: {}", args.unwrap_err());
}

#[test]
fn incremental_alias_enables_iterate() {
let args = super::Args::try_parse_from(["mutants", "--incremental"]).unwrap();
assert!(args.iterate);
}

#[test]
fn option_help_sentence_case_without_period() {
let args = super::Args::command();
Expand Down
Loading