From 41a6d015ff6d7fb778b96dec0426223a7f1b4e44 Mon Sep 17 00:00:00 2001 From: laurent Date: Sun, 19 Nov 2017 09:07:50 +0000 Subject: [PATCH] More tests. --- tests/ui/booleans.rs | 2 ++ tests/ui/booleans.stderr | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/tests/ui/booleans.rs b/tests/ui/booleans.rs index b3463d03c..0898de105 100644 --- a/tests/ui/booleans.rs +++ b/tests/ui/booleans.rs @@ -54,4 +54,6 @@ fn methods_with_negation() { let c = false; let _ = !(a.is_some() && !c); let _ = !(!c ^ c) || !a.is_some(); + let _ = (!c ^ c) || !a.is_some(); + let _ = !c ^ c || !a.is_some(); } diff --git a/tests/ui/booleans.stderr b/tests/ui/booleans.stderr index f38e55860..37b9b3941 100644 --- a/tests/ui/booleans.stderr +++ b/tests/ui/booleans.stderr @@ -166,3 +166,15 @@ error: this boolean expression can be simplified 56 | let _ = !(!c ^ c) || !a.is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()` +error: this boolean expression can be simplified + --> $DIR/booleans.rs:57:13 + | +57 | let _ = (!c ^ c) || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:58:13 + | +58 | let _ = !c ^ c || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()` +