diff --git a/Cargo.toml b/Cargo.toml index c07a0bf5e247..058dc012cfa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ regex_macros = { version = "0.1.33", optional = true } semver = "0.2.1" toml = "0.1" unicode-normalization = "0.1" -quine-mc_cluskey = "0.2.1" +quine-mc_cluskey = "0.2.2" [dev-dependencies] compiletest_rs = "0.1.0" diff --git a/src/booleans.rs b/src/booleans.rs index b43f22973115..b603d5188aad 100644 --- a/src/booleans.rs +++ b/src/booleans.rs @@ -275,7 +275,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> { return; } // if the number of occurrences of a terminal decreases or any of the stats decreases while none increases - improvement = (stats.terminals[i] > simplified_stats.terminals[i]) || + improvement |= (stats.terminals[i] > simplified_stats.terminals[i]) || (stats.negations > simplified_stats.negations && stats.ops == simplified_stats.ops) || (stats.ops > simplified_stats.ops && stats.negations == simplified_stats.negations); } diff --git a/tests/compile-fail/booleans.rs b/tests/compile-fail/booleans.rs index ecaa52019c6c..008e6dcdda90 100644 --- a/tests/compile-fail/booleans.rs +++ b/tests/compile-fail/booleans.rs @@ -77,5 +77,8 @@ fn equality_stuff() { //|~ SUGGESTION let _ = false; let _ = a > b && a == b; - let _ = a != b || !(a != b || c == d); + let _ = a != b || !(a != b || c == d); //~ ERROR this boolean expression can be simplified + //|~ HELP for further information visit + //|~ SUGGESTION let _ = !c == d || a != b; + //|~ SUGGESTION let _ = !(!a != b && c == d); }