From 28da7a2ad9888351eb484118d45e1bf8c516fa4a Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 4 Dec 2021 10:07:56 +0100 Subject: [PATCH] Fix clippy warning warning: this implementation is unsound, as some fields in `Connection` are `!Send` --> src/lib.rs:339:1 339 | unsafe impl Send for Connection {} --- src/cache.rs | 3 +++ src/inner_connection.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/cache.rs b/src/cache.rs index 89459ce..670b2d6 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -60,6 +60,9 @@ impl Connection { // #[derive(Debug)] // FIXME: https://github.com/kyren/hashlink/pull/4 pub struct StatementCache(RefCell, RawStatement>>); +#[allow(clippy::non_send_fields_in_send_ty)] +unsafe impl Send for StatementCache {} + /// Cacheable statement. /// /// Statement will return automatically to the cache by default. diff --git a/src/inner_connection.rs b/src/inner_connection.rs index d03d04a..ce7bce9 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -38,6 +38,8 @@ pub struct InnerConnection { owned: bool, } +unsafe impl Send for InnerConnection {} + impl InnerConnection { #[allow(clippy::mutex_atomic)] #[inline]