From 0eefdda065c1e8ca429287ae35ed78e51d6fe1bc Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Wed, 2 Oct 2024 12:57:55 +0200 Subject: [PATCH] Fix rustc warnings Signed-off-by: Denis Varlakov --- givre/src/lib.rs | 3 +++ givre/src/signing/aggregate.rs | 1 + givre/src/signing/full_signing.rs | 4 ++++ givre/src/signing/round2.rs | 2 ++ 4 files changed, 10 insertions(+) diff --git a/givre/src/lib.rs b/givre/src/lib.rs index 09d2fc7..88d81b7 100644 --- a/givre/src/lib.rs +++ b/givre/src/lib.rs @@ -204,6 +204,9 @@ pub mod key_share { } mod error { + // It's currently only needed in full signing, but better keep it always in the code + #![cfg_attr(not(feature = "full-signing"), allow(dead_code, unused_imports))] + #[cfg(feature = "std")] pub use std::error::Error as StdError; diff --git a/givre/src/signing/aggregate.rs b/givre/src/signing/aggregate.rs index 04b5eee..53145c5 100644 --- a/givre/src/signing/aggregate.rs +++ b/givre/src/signing/aggregate.rs @@ -183,6 +183,7 @@ impl<'a, C: Ciphersuite> AggregateOptions<'a, C> { /// /// CAUTION: additive shift MUST BE derived from the extended public key obtained from /// the key share which is used for signing by calling [`utils::derive_additive_shift`]. + #[cfg(feature = "hd-wallet")] pub(crate) fn dangerous_set_hd_additive_shift( mut self, hd_additive_shift: Scalar, diff --git a/givre/src/signing/full_signing.rs b/givre/src/signing/full_signing.rs index b1a5429..4f2bf0c 100644 --- a/givre/src/signing/full_signing.rs +++ b/givre/src/signing/full_signing.rs @@ -309,9 +309,11 @@ enum SigningOutput { /// Interactive Signing error #[derive(Debug)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] pub struct FullSigningError(Reason); #[derive(Debug)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] enum Reason { NonTaprootCiphersuite, NOverflowsU16, @@ -324,6 +326,7 @@ enum Reason { } #[derive(Debug)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] enum IoError { Send(Box), Recv(Box), @@ -339,6 +342,7 @@ impl IoError { } #[derive(Debug)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] enum Bug { UnexpectedOutput, AdditiveShiftWithoutHdFeature, diff --git a/givre/src/signing/round2.rs b/givre/src/signing/round2.rs index 12e08c3..621b57c 100644 --- a/givre/src/signing/round2.rs +++ b/givre/src/signing/round2.rs @@ -135,6 +135,7 @@ impl<'a, C: Ciphersuite> SigningOptions<'a, C> { /// /// CAUTION: additive shift MUST BE derived from the extended public key obtained from /// the key share which is used for signing by calling [`utils::derive_additive_shift`]. + #[cfg(feature = "hd-wallet")] pub(crate) fn dangerous_set_hd_additive_shift( mut self, hd_additive_shift: Scalar, @@ -450,6 +451,7 @@ fn normalize_key_share( pub struct SigningError(Reason); #[derive(Debug)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] enum Reason { #[cfg(feature = "taproot")] MissingTaprootMerkleRoot,