From 87da3656406e2a3cde50709ddd8623893d876b9a Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 10 Dec 2024 18:21:01 -0500 Subject: [PATCH] !fixup more clippy fixes --- soroban-env-host/src/builtin_contracts/contract_error.rs | 1 + .../src/builtin_contracts/stellar_asset_contract/balance.rs | 2 +- soroban-env-host/src/crypto/bls12_381.rs | 1 + soroban-env-host/src/e2e_invoke.rs | 2 +- soroban-env-host/src/fees.rs | 2 +- soroban-env-host/src/host/metered_xdr.rs | 2 +- soroban-env-host/src/host/trace/fmt.rs | 6 +++--- soroban-env-host/src/vm.rs | 1 - soroban-env-host/src/vm/dispatch.rs | 2 +- soroban-env-host/src/vm/func_info.rs | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/soroban-env-host/src/builtin_contracts/contract_error.rs b/soroban-env-host/src/builtin_contracts/contract_error.rs index 1f5345937..6ee435f2a 100644 --- a/soroban-env-host/src/builtin_contracts/contract_error.rs +++ b/soroban-env-host/src/builtin_contracts/contract_error.rs @@ -1,3 +1,4 @@ +#![allow(non_local_definitions)] use num_derive::FromPrimitive; use soroban_env_common::Error; diff --git a/soroban-env-host/src/builtin_contracts/stellar_asset_contract/balance.rs b/soroban-env-host/src/builtin_contracts/stellar_asset_contract/balance.rs index c13c0ebbf..3249ca95d 100644 --- a/soroban-env-host/src/builtin_contracts/stellar_asset_contract/balance.rs +++ b/soroban-env-host/src/builtin_contracts/stellar_asset_contract/balance.rs @@ -32,7 +32,7 @@ use super::storage_types::{BalanceValue, BALANCE_EXTEND_AMOUNT, BALANCE_TTL_THRE /// semantics have been implemented for these balances. If the asset issuer has /// the AUTH_REQUIRED flag set, then the non-account identifier must first be authorized /// by the issuer/admin before it's allowed to hold a balance. - +// // Metering: covered by components. pub(crate) fn read_balance(e: &Host, addr: Address) -> Result { match addr.to_sc_address()? { diff --git a/soroban-env-host/src/crypto/bls12_381.rs b/soroban-env-host/src/crypto/bls12_381.rs index 8b1c862fe..1371bc81b 100644 --- a/soroban-env-host/src/crypto/bls12_381.rs +++ b/soroban-env-host/src/crypto/bls12_381.rs @@ -35,6 +35,7 @@ pub(crate) const G2_SERIALIZED_SIZE: usize = FP2_SERIALIZED_SIZE * 2; pub(crate) const FR_SERIALIZED_SIZE: usize = 32; #[inline(always)] +#[allow(clippy::manual_div_ceil)] fn units_of_fp() -> u64 { ((EXPECTED_SIZE + FP_SERIALIZED_SIZE - 1) / FP_SERIALIZED_SIZE) as u64 } diff --git a/soroban-env-host/src/e2e_invoke.rs b/soroban-env-host/src/e2e_invoke.rs index cae1d7675..d97fc920c 100644 --- a/soroban-env-host/src/e2e_invoke.rs +++ b/soroban-env-host/src/e2e_invoke.rs @@ -856,7 +856,7 @@ struct StorageMapSnapshotSource<'a> { map: &'a StorageMap, } -impl<'a> SnapshotSource for StorageMapSnapshotSource<'a> { +impl SnapshotSource for StorageMapSnapshotSource<'_> { fn get(&self, key: &Rc) -> Result, HostError> { if let Some(Some((entry, live_until_ledger))) = self.map.get::>(key, self.budget)? diff --git a/soroban-env-host/src/fees.rs b/soroban-env-host/src/fees.rs index 1ddbd486d..93c2c87cc 100644 --- a/soroban-env-host/src/fees.rs +++ b/soroban-env-host/src/fees.rs @@ -3,7 +3,7 @@ /// This is technically not part of the Soroban host and is provided here for /// the sake of sharing between the systems that run Soroban host (such as /// Stellar core or Soroban RPC service). - +/// /// Rough estimate of the base size of any transaction result in the archives /// (independent of the transaction envelope size). pub const TX_BASE_RESULT_SIZE: u32 = 300; diff --git a/soroban-env-host/src/host/metered_xdr.rs b/soroban-env-host/src/host/metered_xdr.rs index 77aa77d8e..ec8ddf419 100644 --- a/soroban-env-host/src/host/metered_xdr.rs +++ b/soroban-env-host/src/host/metered_xdr.rs @@ -11,7 +11,7 @@ struct MeteredWrite<'a, W: Write> { w: &'a mut W, } -impl<'a, W> Write for MeteredWrite<'a, W> +impl Write for MeteredWrite<'_, W> where W: Write, { diff --git a/soroban-env-host/src/host/trace/fmt.rs b/soroban-env-host/src/host/trace/fmt.rs index da424327b..c70c1cc76 100644 --- a/soroban-env-host/src/host/trace/fmt.rs +++ b/soroban-env-host/src/host/trace/fmt.rs @@ -2,7 +2,7 @@ use super::{TraceEvent, TraceState}; use crate::{host::Frame, xdr::ContractExecutable, Symbol, SymbolObject, SymbolSmall, Val}; use core::fmt::{Debug, Display}; -impl<'a> Debug for TraceEvent<'a> { +impl Debug for TraceEvent<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { TraceEvent::Begin => write!(f, "TraceEvent::Begin"), @@ -86,7 +86,7 @@ impl Display for FrameId { } } -impl<'a> TraceEvent<'a> { +impl TraceEvent<'_> { pub fn is_begin(&self) -> bool { match self { TraceEvent::Begin => true, @@ -146,7 +146,7 @@ impl<'a> TraceEvent<'a> { } } -impl<'a> Display for TraceEvent<'a> { +impl Display for TraceEvent<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { TraceEvent::PushCtx(ctx) => { diff --git a/soroban-env-host/src/vm.rs b/soroban-env-host/src/vm.rs index 5e7779a8c..10b52a188 100644 --- a/soroban-env-host/src/vm.rs +++ b/soroban-env-host/src/vm.rs @@ -281,7 +281,6 @@ impl Vm { /// With the introduction of the granular cost inputs this method /// should only be used for the one-off full parses of the new Wasms /// during the initial upload verification. - pub fn new(host: &Host, contract_id: Hash, wasm: &[u8]) -> Result, HostError> { let cost_inputs = VersionedContractCodeCostInputs::V0 { wasm_bytes: wasm.len(), diff --git a/soroban-env-host/src/vm/dispatch.rs b/soroban-env-host/src/vm/dispatch.rs index 460c4c28d..514e12cd9 100644 --- a/soroban-env-host/src/vm/dispatch.rs +++ b/soroban-env-host/src/vm/dispatch.rs @@ -129,7 +129,7 @@ impl RelativeObjectConversion for U32Val {} /////////////////////////////////////////////////////////////////////////////// /// X-macro use: dispatch functions /////////////////////////////////////////////////////////////////////////////// - +// // This is a callback macro that pattern-matches the token-tree passed by the // x-macro (call_macro_with_all_host_functions) and produces a suite of // dispatch-function definitions. diff --git a/soroban-env-host/src/vm/func_info.rs b/soroban-env-host/src/vm/func_info.rs index 647c478f8..d70d9faa5 100644 --- a/soroban-env-host/src/vm/func_info.rs +++ b/soroban-env-host/src/vm/func_info.rs @@ -85,7 +85,7 @@ macro_rules! host_function_info_helper { /////////////////////////////////////////////////////////////////////////////// /// X-macro use: static HOST_FUNCTIONS array of HostFuncInfo /////////////////////////////////////////////////////////////////////////////// - +// // This is a callback macro that pattern-matches the token-tree passed by the // x-macro (call_macro_with_all_host_functions) and produces a suite of // dispatch-function definitions.