From e056c452276c0ad15bc2be6068c55feae219485f Mon Sep 17 00:00:00 2001 From: lisicky Date: Sun, 23 Jun 2024 02:07:48 +0700 Subject: [PATCH] warnings cleanup --- rust/src/builders/mint_builder.rs | 2 ++ rust/src/builders/script_structs/script_witness_type.rs | 1 + rust/src/builders/tx_inputs_builder.rs | 1 + rust/src/protocol_types/credentials.rs | 1 + .../protocol_types/governance/proposals/voting_proposals.rs | 1 + rust/src/protocol_types/native_scripts.rs | 1 + rust/src/protocol_types/plutus/plutus_data.rs | 1 + rust/src/protocol_types/plutus/plutus_scripts.rs | 2 ++ rust/src/protocol_types/plutus/redeemers.rs | 1 + rust/src/protocol_types/protocol_param_update.rs | 6 ------ rust/src/rational.rs | 1 + rust/src/tests/builders/tx_builder.rs | 4 ---- 12 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rust/src/builders/mint_builder.rs b/rust/src/builders/mint_builder.rs index b9954b22..0c746150 100644 --- a/rust/src/builders/mint_builder.rs +++ b/rust/src/builders/mint_builder.rs @@ -42,6 +42,8 @@ struct NativeMints { } impl NativeMints { + + #[allow(dead_code)] fn script_hash(&self) -> PolicyID { match &self.script { NativeScriptSourceEnum::NativeScript(script, _) => script.hash(), diff --git a/rust/src/builders/script_structs/script_witness_type.rs b/rust/src/builders/script_structs/script_witness_type.rs index 0e7a8101..8568b338 100644 --- a/rust/src/builders/script_structs/script_witness_type.rs +++ b/rust/src/builders/script_structs/script_witness_type.rs @@ -7,6 +7,7 @@ pub(crate) enum ScriptWitnessType { } impl ScriptWitnessType { + #[allow(dead_code)] pub(crate) fn script_hash(&self) -> ScriptHash { match self { ScriptWitnessType::NativeScriptWitness(script) => script.script_hash(), diff --git a/rust/src/builders/tx_inputs_builder.rs b/rust/src/builders/tx_inputs_builder.rs index 3367966a..8b40ab34 100644 --- a/rust/src/builders/tx_inputs_builder.rs +++ b/rust/src/builders/tx_inputs_builder.rs @@ -330,6 +330,7 @@ impl TxInputsBuilder { .filter_map(|wit| wit.get_script_ref_input_with_size()) } + #[allow(dead_code)] pub(crate) fn get_required_signers(&self) -> Ed25519KeyHashes { self.into() } diff --git a/rust/src/protocol_types/credentials.rs b/rust/src/protocol_types/credentials.rs index 933bc81b..244c76da 100644 --- a/rust/src/protocol_types/credentials.rs +++ b/rust/src/protocol_types/credentials.rs @@ -51,6 +51,7 @@ impl Credentials { } } + #[allow(dead_code)] pub(crate) fn contains(&self, elem: &Credential) -> bool { self.dedup.contains(elem) } diff --git a/rust/src/protocol_types/governance/proposals/voting_proposals.rs b/rust/src/protocol_types/governance/proposals/voting_proposals.rs index 0a33552c..15e5413a 100644 --- a/rust/src/protocol_types/governance/proposals/voting_proposals.rs +++ b/rust/src/protocol_types/governance/proposals/voting_proposals.rs @@ -65,6 +65,7 @@ impl VotingProposals { voting_proposals } + #[allow(dead_code)] pub(crate) fn contains(&self, proposal: &VotingProposal) -> bool { self.dedup.contains(proposal) } diff --git a/rust/src/protocol_types/native_scripts.rs b/rust/src/protocol_types/native_scripts.rs index 59023cbe..3e1bf99e 100644 --- a/rust/src/protocol_types/native_scripts.rs +++ b/rust/src/protocol_types/native_scripts.rs @@ -46,6 +46,7 @@ impl NativeScripts { NativeScripts(scripts) } + #[allow(dead_code)] pub(crate) fn contains(&self, script: &NativeScript) -> bool { self.0.contains(script) } diff --git a/rust/src/protocol_types/plutus/plutus_data.rs b/rust/src/protocol_types/plutus/plutus_data.rs index b04b22b4..3ca884e1 100644 --- a/rust/src/protocol_types/plutus/plutus_data.rs +++ b/rust/src/protocol_types/plutus/plutus_data.rs @@ -490,6 +490,7 @@ impl PlutusList { self.definite_encoding = None; } + #[allow(dead_code)] pub(crate) fn contains(&self, elem: &PlutusData) -> bool { self.elems.contains(elem) } diff --git a/rust/src/protocol_types/plutus/plutus_scripts.rs b/rust/src/protocol_types/plutus/plutus_scripts.rs index 47f563f2..4d6db98a 100644 --- a/rust/src/protocol_types/plutus/plutus_scripts.rs +++ b/rust/src/protocol_types/plutus/plutus_scripts.rs @@ -32,6 +32,7 @@ impl PlutusScripts { self.0.push(elem.clone()); } + #[allow(dead_code)] pub(crate) fn by_version(&self, language: &Language) -> PlutusScripts { PlutusScripts( self.0 @@ -92,6 +93,7 @@ impl PlutusScripts { PlutusScripts(scripts) } + #[allow(dead_code)] pub(crate) fn contains(&self, script: &PlutusScript) -> bool { self.0.contains(&script) } diff --git a/rust/src/protocol_types/plutus/redeemers.rs b/rust/src/protocol_types/plutus/redeemers.rs index 1bab94fa..713f2d98 100644 --- a/rust/src/protocol_types/plutus/redeemers.rs +++ b/rust/src/protocol_types/plutus/redeemers.rs @@ -18,6 +18,7 @@ impl Redeemers { } } + #[allow(dead_code)] pub(crate) fn new_with_serialization_format( redeemers: Vec, serialization_format: CborContainerType, diff --git a/rust/src/protocol_types/protocol_param_update.rs b/rust/src/protocol_types/protocol_param_update.rs index 7e570f48..887b866e 100644 --- a/rust/src/protocol_types/protocol_param_update.rs +++ b/rust/src/protocol_types/protocol_param_update.rs @@ -119,12 +119,6 @@ impl DrepVotingThresholds { } } - pub(crate) fn new_default() -> Self { - Self { - ..Default::default() - } - } - pub fn set_motion_no_confidence(&mut self, motion_no_confidence: &UnitInterval) { self.motion_no_confidence = motion_no_confidence.clone() } diff --git a/rust/src/rational.rs b/rust/src/rational.rs index 8ba079d3..3b9eb8fe 100644 --- a/rust/src/rational.rs +++ b/rust/src/rational.rs @@ -79,6 +79,7 @@ impl Rational { } } + #[allow(dead_code)] pub(crate) fn to_bignum_floor(&self) -> Result { let num = self.numerator(); let denum = self.denominator(); diff --git a/rust/src/tests/builders/tx_builder.rs b/rust/src/tests/builders/tx_builder.rs index b54d92df..6bc65e8c 100644 --- a/rust/src/tests/builders/tx_builder.rs +++ b/rust/src/tests/builders/tx_builder.rs @@ -3776,10 +3776,6 @@ fn test_add_native_script_input() { ); } -fn unsafe_tx_len(b: &TransactionBuilder) -> usize { - b.build_tx_unsafe().unwrap().to_bytes().len() -} - #[test] fn test_native_input_scripts_are_added_to_the_witnesses() { let mut tx_builder = create_reallistic_tx_builder();