From 3573f0e39ba19b39366950e27799230cab2c4bd1 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" <69792125+mayeul-zama@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:14:38 +0200 Subject: [PATCH] chore(hlapi): fix clippy lints --- tfhe/src/high_level_api/booleans/inner.rs | 5 ++--- tfhe/src/high_level_api/global_state.rs | 1 - tfhe/src/high_level_api/integers/signed/inner.rs | 5 ++--- tfhe/src/high_level_api/integers/unsigned/inner.rs | 5 ++--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tfhe/src/high_level_api/booleans/inner.rs b/tfhe/src/high_level_api/booleans/inner.rs index 402f768475..67d557e9d8 100644 --- a/tfhe/src/high_level_api/booleans/inner.rs +++ b/tfhe/src/high_level_api/booleans/inner.rs @@ -1,7 +1,8 @@ use crate::backward_compatibility::booleans::InnerBooleanVersionedOwned; use crate::high_level_api::details::MaybeCloned; +use crate::high_level_api::global_state; #[cfg(feature = "gpu")] -use crate::high_level_api::global_state::{self, with_thread_local_cuda_streams}; +use crate::high_level_api::global_state::with_thread_local_cuda_streams; use crate::integer::BooleanBlock; use crate::Device; use serde::{Deserializer, Serializer}; @@ -219,9 +220,7 @@ impl InnerBoolean { } #[inline] - #[allow(clippy::unused_self, clippy::needless_pass_by_ref_mut)] pub(crate) fn move_to_device_of_server_key_if_set(&mut self) { - #[cfg(feature = "gpu")] if let Some(device) = global_state::device_of_internal_keys() { self.move_to_device(device); } diff --git a/tfhe/src/high_level_api/global_state.rs b/tfhe/src/high_level_api/global_state.rs index ec110bf9f9..60d28d79d6 100644 --- a/tfhe/src/high_level_api/global_state.rs +++ b/tfhe/src/high_level_api/global_state.rs @@ -109,7 +109,6 @@ where }) } -#[cfg(feature = "gpu")] #[inline] pub(in crate::high_level_api) fn device_of_internal_keys() -> Option { // Should use `with_borrow` when its stabilized diff --git a/tfhe/src/high_level_api/integers/signed/inner.rs b/tfhe/src/high_level_api/integers/signed/inner.rs index 9bb6610d33..d883fcdd0a 100644 --- a/tfhe/src/high_level_api/integers/signed/inner.rs +++ b/tfhe/src/high_level_api/integers/signed/inner.rs @@ -1,7 +1,8 @@ use crate::backward_compatibility::integers::SignedRadixCiphertextVersionedOwned; use crate::high_level_api::details::MaybeCloned; +use crate::high_level_api::global_state; #[cfg(feature = "gpu")] -use crate::high_level_api::global_state::{self, with_thread_local_cuda_streams}; +use crate::high_level_api::global_state::with_thread_local_cuda_streams; #[cfg(feature = "gpu")] use crate::integer::gpu::ciphertext::CudaIntegerRadixCiphertext; #[cfg(feature = "gpu")] @@ -208,9 +209,7 @@ impl RadixCiphertext { } #[inline] - #[allow(clippy::unused_self, clippy::needless_pass_by_ref_mut)] pub(crate) fn move_to_device_of_server_key_if_set(&mut self) { - #[cfg(feature = "gpu")] if let Some(device) = global_state::device_of_internal_keys() { self.move_to_device(device); } diff --git a/tfhe/src/high_level_api/integers/unsigned/inner.rs b/tfhe/src/high_level_api/integers/unsigned/inner.rs index d0a00ad372..7926e3613a 100644 --- a/tfhe/src/high_level_api/integers/unsigned/inner.rs +++ b/tfhe/src/high_level_api/integers/unsigned/inner.rs @@ -1,7 +1,8 @@ use crate::backward_compatibility::integers::UnsignedRadixCiphertextVersionedOwned; use crate::high_level_api::details::MaybeCloned; +use crate::high_level_api::global_state; #[cfg(feature = "gpu")] -use crate::high_level_api::global_state::{self, with_thread_local_cuda_streams}; +use crate::high_level_api::global_state::with_thread_local_cuda_streams; #[cfg(feature = "gpu")] use crate::integer::gpu::ciphertext::CudaIntegerRadixCiphertext; use crate::Device; @@ -213,9 +214,7 @@ impl RadixCiphertext { } #[inline] - #[allow(clippy::unused_self, clippy::needless_pass_by_ref_mut)] pub(crate) fn move_to_device_of_server_key_if_set(&mut self) { - #[cfg(feature = "gpu")] if let Some(device) = global_state::device_of_internal_keys() { self.move_to_device(device); }