From 33e268cd3809241d71beb623df33b1074acb5a12 Mon Sep 17 00:00:00 2001 From: Jeeyong Um Date: Sun, 27 Oct 2024 02:52:21 +0900 Subject: [PATCH] chore: Fix clippy warnings --- precompiles/assets-erc20/src/eip2612.rs | 7 ++++--- precompiles/assets-erc20/src/lib.rs | 5 +++-- precompiles/balances-erc20/src/eip2612.rs | 7 ++++--- precompiles/balances-erc20/src/lib.rs | 5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/precompiles/assets-erc20/src/eip2612.rs b/precompiles/assets-erc20/src/eip2612.rs index eff2b44fa7..21e5c466ee 100644 --- a/precompiles/assets-erc20/src/eip2612.rs +++ b/precompiles/assets-erc20/src/eip2612.rs @@ -147,7 +147,7 @@ where Address(address), )); - keccak_256(&domain_separator_inner).into() + keccak_256(&domain_separator_inner) } pub fn generate_permit( @@ -180,6 +180,7 @@ where // Translated from // https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2ERC20.sol#L81 + #[allow(clippy::too_many_arguments)] pub(crate) fn permit( asset_id: AssetIdOf, handle: &mut impl PrecompileHandle, @@ -219,8 +220,8 @@ where ); let mut sig = [0u8; 65]; - sig[0..32].copy_from_slice(&r.as_bytes()); - sig[32..64].copy_from_slice(&s.as_bytes()); + sig[0..32].copy_from_slice(r.as_bytes()); + sig[32..64].copy_from_slice(s.as_bytes()); sig[64] = v; let signer = sp_io::crypto::secp256k1_ecdsa_recover(&sig, &permit) diff --git a/precompiles/assets-erc20/src/lib.rs b/precompiles/assets-erc20/src/lib.rs index ae9939aade..1040a012a9 100644 --- a/precompiles/assets-erc20/src/lib.rs +++ b/precompiles/assets-erc20/src/lib.rs @@ -66,7 +66,7 @@ pub type AssetIdOf = , we first check whether the AssetId /// exists in pallet-assets @@ -334,7 +334,7 @@ where { let caller: Runtime::AccountId = Runtime::AddressMapping::into_account_id(handle.context().caller); - let from: Runtime::AccountId = Runtime::AddressMapping::into_account_id(from.clone()); + let from: Runtime::AccountId = Runtime::AddressMapping::into_account_id(from); let to: Runtime::AccountId = Runtime::AddressMapping::into_account_id(to); // If caller is "from", it can spend as much as it wants from its own balance. @@ -506,6 +506,7 @@ where } #[precompile::public("permit(address,address,uint256,uint256,uint8,bytes32,bytes32)")] + #[allow(clippy::too_many_arguments)] fn eip2612_permit( asset_id: AssetIdOf, handle: &mut impl PrecompileHandle, diff --git a/precompiles/balances-erc20/src/eip2612.rs b/precompiles/balances-erc20/src/eip2612.rs index eeac5aa610..65f1719d49 100644 --- a/precompiles/balances-erc20/src/eip2612.rs +++ b/precompiles/balances-erc20/src/eip2612.rs @@ -59,7 +59,7 @@ where Address(address), )); - keccak_256(&domain_separator_inner).into() + keccak_256(&domain_separator_inner) } pub fn generate_permit( @@ -91,6 +91,7 @@ where // Translated from // https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2ERC20.sol#L81 + #[allow(clippy::too_many_arguments)] pub(crate) fn permit( handle: &mut impl PrecompileHandle, owner: Address, @@ -126,8 +127,8 @@ where ); let mut sig = [0u8; 65]; - sig[0..32].copy_from_slice(&r.as_bytes()); - sig[32..64].copy_from_slice(&s.as_bytes()); + sig[0..32].copy_from_slice(r.as_bytes()); + sig[32..64].copy_from_slice(s.as_bytes()); sig[64] = v; let signer = sp_io::crypto::secp256k1_ecdsa_recover(&sig, &permit) diff --git a/precompiles/balances-erc20/src/lib.rs b/precompiles/balances-erc20/src/lib.rs index 2652182c40..fc1f7a54ce 100644 --- a/precompiles/balances-erc20/src/lib.rs +++ b/precompiles/balances-erc20/src/lib.rs @@ -286,7 +286,7 @@ where Some(origin).into(), pallet_balances::Call::::transfer_allow_death { dest: Runtime::Lookup::unlookup(to), - value: value, + value, }, SYSTEM_ACCOUNT_SIZE, )?; @@ -352,7 +352,7 @@ where Some(from).into(), pallet_balances::Call::::transfer_allow_death { dest: Runtime::Lookup::unlookup(to), - value: value, + value, }, SYSTEM_ACCOUNT_SIZE, )?; @@ -461,6 +461,7 @@ where } #[precompile::public("permit(address,address,uint256,uint256,uint8,bytes32,bytes32)")] + #[allow(clippy::too_many_arguments)] fn eip2612_permit( handle: &mut impl PrecompileHandle, owner: Address,