-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude based on regex of statements? #301
Comments
In the case you mention, isn't this at least possible? let mut r = {
#[cfg_attr(test, mutants::skip)]
{
String::with_capacity(s.len() + replacement.len());
}
}; I do have a related request though. |
Yes, I think that framing
The stable compiler also tells me that's not supported yet, although you could do it on nightly:
Edit: actually I'm not so sure about skipping functions that only contain assertions by default: they might be enforcing invariants that are intended to be checked at runtime. |
Yes, but if it is the only reason for a |
There are alternatives that don't add a (tiny) dev dependency: |
#315 proposes to skip calls to functions/methods matching a string, which is perhaps more precise than a regexp of the statement. |
cargo-mutants/src/span.rs
Line 103 in b2a4bd1
The
String::with_capacity
isn't wrong, and it's probably slightly beneficial to have there, but the side effects are subtle and it's probably asking too much to test it. (Actually, in this specific case we coulddebug_assert
the capacity to shush it, but that's a bit messy.)We cannot yet add a
#[mutants::skip]
here, because expression attributes aren't stable yet (rust-lang/rust#15701).Maybe it would be useful to have config that can match against the whole expression text and then skip; that would probably help in other cases of code that only has unimportant side effects such as trace statements.
The text was updated successfully, but these errors were encountered: