False positives replacing equivalent expression, like Duration::ZERO
and Default::default()
#435
Description
For example cargo-mutants will complain that it can replace std::time::Duration::ZERO
with Default::default()
.
Some cases in the standard library can maybe be special cased but there are often functions that are equivalent to Default::default()
but are provided because they provide a more meaningful name. In fact Default::default()
is often implemented just by calling a different method like Self::empty()
.
I don't know if there is a general solution to this problem. Maybe there can be a basic complexity metric such that this replacement is only done if the thing being replaced is more complex than a simple field access, function call or similar. For example Duration::from_secs(0)
or accessing some constant DELAY
likely should also not be replaced.
Vaguely related: #418