Skip to content

Commit

Permalink
chore(backward): move allow(dead_code) to dispatch variants
Browse files Browse the repository at this point in the history
This allows to detect unused dispatch enums
  • Loading branch information
nsarlin-zama committed Dec 6, 2024
1 parent 5e55167 commit b700a24
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tfhe-zk-pok/src/backward_compatibility/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ impl Display for IncompleteProof {
impl Error for IncompleteProof {}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum GroupElementsVersions<G: Curve> {
#[allow(dead_code)]
V0(GroupElements<G>),
}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum SerializableGroupElementsVersions {
#[allow(dead_code)]
V0(SerializableGroupElements),
}

Expand Down
4 changes: 2 additions & 2 deletions tfhe-zk-pok/src/backward_compatibility/pke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub enum ProofVersions<G: Curve> {
}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum ComputeLoadProofFieldVersions<G: Curve> {
#[allow(dead_code)]
V0(ComputeLoadProofFields<G>),
}

Expand Down Expand Up @@ -107,11 +107,11 @@ where
}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum CompressedComputeLoadProofFieldsVersions<G: Curve>
where
G::G1: Compressible,
G::G2: Compressible,
{
#[allow(dead_code)]
V0(CompressedComputeLoadProofFields<G>),
}
2 changes: 1 addition & 1 deletion tfhe/src/integer/backward_compatibility/ciphertext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ pub enum CompressedModulusSwitchedRadixCiphertextVersions {
}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum CompressedModulusSwitchedRadixCiphertextGenericVersions {
#[allow(dead_code)]
V0(CompressedModulusSwitchedRadixCiphertextGeneric),
}

Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/shortint/backward_compatibility/ciphertext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ pub enum CompressedModulusSwitchedCiphertextVersions {
}

#[derive(VersionsDispatch)]
#[allow(dead_code)]
pub(crate) enum InternalCompressedModulusSwitchedCiphertextVersions {
#[allow(dead_code)]
V0(InternalCompressedModulusSwitchedCiphertext),
}

Expand Down
3 changes: 2 additions & 1 deletion utils/tfhe-versionable/examples/manual_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ impl<T: Unversionize + Serialize + for<'de> 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>),
}

Expand Down
4 changes: 2 additions & 2 deletions utils/tfhe-versionable/examples/transparent_then_not.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ struct MyStructWrapper<T> {
count: u64,
}

// We need to create a dispatch enum that has the same history as the inner type until the point
// where the wrapper is not transparent anymore.
// We need to create a dispatch enum that follows the version numbers of the inner type, until the
// point where the wrapper is not transparent anymore.
#[derive(VersionsDispatch)]
#[allow(unused)]
enum MyStructWrapperVersions<T> {
Expand Down
2 changes: 1 addition & 1 deletion utils/tfhe-versionable/tests/bounds_private_in_public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ mod mymod {
struct Private<T>(T);

#[derive(VersionsDispatch)]
#[allow(dead_code)]
enum PrivateVersions<T> {
#[allow(dead_code)]
V0(Private<T>),
}
}
Expand Down

0 comments on commit b700a24

Please sign in to comment.