Skip to content

Handling missed mutants

Martin Pool edited this page Mar 2, 2024 · 1 revision

Redundant comparisons

(From mutants options.rs))

        if glob_str.contains('/') || glob_str.contains(std::path::MAIN_SEPARATOR) {

On Linux the main separator is also /, so mutations of || to && can't be detected.

Here Mutants is pointing out something slightly suspicious about the code, but it just doesn't understand that this code will be useful on other platforms...

We can't easily add an attribute on that expression because "attributes on expressions are experimental".

Maybe a good way to write it is to just use a higher level function that better expresses intent:

        if Utf8Path::new(glob_str).components().count() > 1 {
Clone this wiki locally