cargo-mutants
cargo-mutants copied to clipboard
Functions mutated to return constant with `NonZero` return value are always unviable
fn foo() -> NonZero<usize> is mutaned to return a constant like NonZero::new(1) which will never compile because NonZero::new() returns an Option<NonZero<_>>. It needs an .unwrap() there!
Not sure how smart the type-specific mutation mechanism is but adding an .unwrap() for NonZero types could suddenly make a lot more mutants viable.
Hi, thanks for reporting this.
I don't know if we mutate NonZero<usize> at all at the moment, but we probably should. And it looks like the existing mutation for NonZeroUsize is wrong in the way you say.