From 97b49cded2145e00325aa3b7af1bc18a126a8a95 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:21:08 +0300 Subject: [PATCH] clippy fix --- .../abi-tester/src/abi_test_type.rs | 1 + framework/base/src/storage/mappers/vec_mapper.rs | 2 +- framework/snippets/src/network_response.rs | 16 ++++++---------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/contracts/feature-tests/abi-tester/src/abi_test_type.rs b/contracts/feature-tests/abi-tester/src/abi_test_type.rs index 2928e81c89..c70f1aec42 100644 --- a/contracts/feature-tests/abi-tester/src/abi_test_type.rs +++ b/contracts/feature-tests/abi-tester/src/abi_test_type.rs @@ -45,5 +45,6 @@ pub struct OnlyShowsUpInEsdtAttr { #[derive(TypeAbi)] pub struct ManagedDecimalWrapper { + #[allow(dead_code)] pub field: ManagedDecimal>, } diff --git a/framework/base/src/storage/mappers/vec_mapper.rs b/framework/base/src/storage/mappers/vec_mapper.rs index de2eb55d82..9869130864 100644 --- a/framework/base/src/storage/mappers/vec_mapper.rs +++ b/framework/base/src/storage/mappers/vec_mapper.rs @@ -12,7 +12,7 @@ use crate::{ storage::{storage_clear, storage_set, StorageKey}, types::{ManagedAddress, ManagedType, MultiValueEncoded}, }; -use core::{marker::PhantomData, usize}; +use core::marker::PhantomData; const ITEM_SUFFIX: &[u8] = b".item"; const LEN_SUFFIX: &[u8] = b".len"; diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index 2fb336a7f9..a41e880f25 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -15,7 +15,7 @@ const LOG_IDENTIFIER_SIGNAL_ERROR: &str = "signalError"; pub fn parse_tx_response(tx: TransactionOnNetwork) -> TxResponse { let tx_error = process_signal_error(&tx); if !tx_error.is_success() { - TxResponse { + return TxResponse { tx_error, ..Default::default() }; @@ -43,8 +43,7 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { tx_response.out = process_out(tx); - process_new_deployed_address( - tx_response, + tx_response.new_deployed_address = process_new_deployed_address( tx.sender.to_bytes(), tx.nonce, tx.processing_type_on_destination.clone(), @@ -57,10 +56,8 @@ fn process_out(tx: &TransactionOnNetwork) -> Vec> { if let Some(out_scr) = out_scr { decode_scr_data_or_panic(&out_scr.data) - } else if let Some(data) = process_out_from_log(tx) { - data } else { - Vec::new() + process_out_from_log(tx).unwrap_or_default() } } @@ -86,13 +83,12 @@ fn process_out_from_log(tx: &TransactionOnNetwork) -> Option>> { } fn process_new_deployed_address( - tx_response: &mut TxResponse, sender_address_bytes: [u8; 32], nonce: u64, processing_type_on_destination: String, -) { +) -> Option
{ if processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { - return; + return None; } let sender_nonce_bytes = nonce.to_le_bytes(); @@ -109,7 +105,7 @@ fn process_new_deployed_address( address[10..30].copy_from_slice(&address_keccak[10..30]); address[30..32].copy_from_slice(&sender_address_bytes[30..32]); - tx_response.new_deployed_address = Some(Address::from(address)); + Some(Address::from(address)) } fn process_new_issued_token_identifier(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) {