about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-02 22:12:46 +0000
committerbors <bors@rust-lang.org>2023-04-02 22:12:46 +0000
commit7fe83edc11ccc255372be5a7bc0372d6011cc5df (patch)
treeabb71448ca79b90a19bbee20c532c228b79bfa9b /tests
parent8f0ba1f2e0c08d67c6b57a2e6b01cc87428b5341 (diff)
parent36047b0216b9fb4741e8927c7e6b644727e02fdf (diff)
Auto merge of #10588 - blyxyas:fix-allow_nonminimal_bool, r=llogiq
Fix `nonminimal_bool` `#[allow]` attributes.

Closes #10435
changelog: [`nonminimal_bool`]: Fix false-positive where the lint ignore `#[allow]` attributes.

r? `@llogiq`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/nonminimal_bool.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/nonminimal_bool.rs b/tests/ui/nonminimal_bool.rs
index 3b5a374b4a7..80cc7c60f56 100644
--- a/tests/ui/nonminimal_bool.rs
+++ b/tests/ui/nonminimal_bool.rs
@@ -92,3 +92,21 @@ fn issue_10523_2() {
     }
     if a!() {}
 }
+
+fn issue_10435() {
+    let x = vec![0];
+    let y = vec![1];
+    let z = vec![2];
+
+    // vvv Should not lint
+    #[allow(clippy::nonminimal_bool)]
+    if !x.is_empty() && !(y.is_empty() || z.is_empty()) {
+        println!("{}", line!());
+    }
+
+    // vvv Should not lint (#10435 talks about a bug where it lints)
+    #[allow(clippy::nonminimal_bool)]
+    if !(x == [0]) {
+        println!("{}", line!());
+    }
+}