v25.0.1 match arms and guards are mutated in excluded functions
The new mutation patterns that delete match arms or replace match guards with true/false are applied in sections that have been excluded, e.g. exclude_re = ["impl Debug"].
I have added "match arm" and "match guard" to the exclusion list to overcome it, but ideally they would be shown for other areas. I think testing these is a good idea if it can be modified so that excluded implementations, functions etc. exclude the whole block from any further mutations.
The immediate cause here is that the exclude_re matches against the mutant name, and these mutants don't include the impl/fn name.
So I think there are two possibly complementary fixes:
- Include the type/impl/fn names in all mutant names, which may anyhow just make them easier to quickly read.
- Perhaps have separate "exclude impls of this type" (e.g.,
Debug) and then just don't walk into them at all, rather than matching the names. This does add more configuration options but it's also more precise.
I'll also mention that it's often easy and perhaps useful to write tests for custom Debug impls although I can also see how people might not feel it's a priority.
Nice. The fix is good. We have removed the match arm and guard excludes from our mutation testing in https://github.com/rust-bitcoin/rust-bitcoin/pull/4654 and it's working as expected.
Great, thanks for letting me know.