about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-31 13:36:09 +0000
committerbors <bors@rust-lang.org>2023-05-31 13:36:09 +0000
commite85869578dfb64a0edda602bb26982e80ec579e8 (patch)
tree666674a3bed1bcf69906515dd09a158259f47e15 /tests
parent8793c2a5763a12c0092c6497105240eddfe7f46c (diff)
parente4927f98fa53a9d4dd466a9035f71fb1c2a5940b (diff)
downloadrust-e85869578dfb64a0edda602bb26982e80ec579e8.tar.gz
rust-e85869578dfb64a0edda602bb26982e80ec579e8.zip
Auto merge of #10845 - disco07:master, r=giraffate
nonminimal_bool fix double not

fix issue https://github.com/rust-lang/rust-clippy/issues/10836

changelog: Fix [`nonminimal_bool`] false positive when `!!x`, `x` isn't boolean and implements `Not`
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/nonminimal_bool.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/nonminimal_bool.rs b/tests/ui/nonminimal_bool.rs
index 80cc7c60f56..fec6b7713ee 100644
--- a/tests/ui/nonminimal_bool.rs
+++ b/tests/ui/nonminimal_bool.rs
@@ -110,3 +110,17 @@ fn issue_10435() {
         println!("{}", line!());
     }
 }
+
+fn issue10836() {
+    struct Foo(bool);
+    impl std::ops::Not for Foo {
+        type Output = bool;
+
+        fn not(self) -> Self::Output {
+            !self.0
+        }
+    }
+
+    // Should not lint
+    let _: bool = !!Foo(true);
+}