From eb461a7622f4918e9cff7456d54a202285b450f2 Mon Sep 17 00:00:00 2001 From: Nicolas Sarlin Date: Thu, 5 Dec 2024 15:26:39 +0100 Subject: [PATCH] chore(backward): move allow(dead_code) to dispatch variants This allows to detect unused dispatch enums --- tfhe-zk-pok/src/backward_compatibility/mod.rs | 4 ++-- tfhe-zk-pok/src/backward_compatibility/pke.rs | 4 ++-- tfhe/src/integer/backward_compatibility/ciphertext/mod.rs | 2 +- tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs | 2 +- utils/tfhe-versionable/examples/manual_impl.rs | 3 ++- utils/tfhe-versionable/tests/bounds_private_in_public.rs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tfhe-zk-pok/src/backward_compatibility/mod.rs b/tfhe-zk-pok/src/backward_compatibility/mod.rs index 81769bd91d..b1b4b6f4ea 100644 --- a/tfhe-zk-pok/src/backward_compatibility/mod.rs +++ b/tfhe-zk-pok/src/backward_compatibility/mod.rs @@ -60,14 +60,14 @@ impl Display for IncompleteProof { impl Error for IncompleteProof {} #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum GroupElementsVersions { + #[allow(dead_code)] V0(GroupElements), } #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum SerializableGroupElementsVersions { + #[allow(dead_code)] V0(SerializableGroupElements), } diff --git a/tfhe-zk-pok/src/backward_compatibility/pke.rs b/tfhe-zk-pok/src/backward_compatibility/pke.rs index c84a026474..4ece54522f 100644 --- a/tfhe-zk-pok/src/backward_compatibility/pke.rs +++ b/tfhe-zk-pok/src/backward_compatibility/pke.rs @@ -49,8 +49,8 @@ pub enum ProofVersions { } #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum ComputeLoadProofFieldVersions { + #[allow(dead_code)] V0(ComputeLoadProofFields), } @@ -107,11 +107,11 @@ where } #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum CompressedComputeLoadProofFieldsVersions where G::G1: Compressible, G::G2: Compressible, { + #[allow(dead_code)] V0(CompressedComputeLoadProofFields), } diff --git a/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs b/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs index 1a2459e83a..3061b8a277 100644 --- a/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs +++ b/tfhe/src/integer/backward_compatibility/ciphertext/mod.rs @@ -77,8 +77,8 @@ pub enum CompressedModulusSwitchedRadixCiphertextVersions { } #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum CompressedModulusSwitchedRadixCiphertextGenericVersions { + #[allow(dead_code)] V0(CompressedModulusSwitchedRadixCiphertextGeneric), } diff --git a/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs b/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs index 2e4ce9dd17..50a31e00e2 100644 --- a/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs +++ b/tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs @@ -134,8 +134,8 @@ pub enum CompressedModulusSwitchedCiphertextVersions { } #[derive(VersionsDispatch)] -#[allow(dead_code)] pub(crate) enum InternalCompressedModulusSwitchedCiphertextVersions { + #[allow(dead_code)] V0(InternalCompressedModulusSwitchedCiphertext), } diff --git a/utils/tfhe-versionable/examples/manual_impl.rs b/utils/tfhe-versionable/examples/manual_impl.rs index efc3323218..58b043fd2a 100644 --- a/utils/tfhe-versionable/examples/manual_impl.rs +++ b/utils/tfhe-versionable/examples/manual_impl.rs @@ -84,9 +84,10 @@ impl Deserialize<'de> + Default> Unversio // Since MyStructV0 is only composed of built-in types, it does not need recursive versioning and // can be used as its own "version type". #[derive(Serialize)] -#[allow(dead_code)] enum MyStructVersionsDispatch<'vers, T: 'vers + Versionize> { + #[allow(dead_code)] V0(MyStructV0), + #[allow(dead_code)] V1(MyStructVersion<'vers, T>), } diff --git a/utils/tfhe-versionable/tests/bounds_private_in_public.rs b/utils/tfhe-versionable/tests/bounds_private_in_public.rs index 489d6ad0fc..2168272bd0 100644 --- a/utils/tfhe-versionable/tests/bounds_private_in_public.rs +++ b/utils/tfhe-versionable/tests/bounds_private_in_public.rs @@ -30,8 +30,8 @@ mod mymod { struct Private(T); #[derive(VersionsDispatch)] - #[allow(dead_code)] enum PrivateVersions { + #[allow(dead_code)] V0(Private), } }