difftreelog
style fix clippy warnings
in: master
26 files changed
.maintain/frame-weight-template.hbsdiffbeforeafterboth--- a/.maintain/frame-weight-template.hbs
+++ b/.maintain/frame-weight-template.hbs
@@ -14,6 +14,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -57,9 +57,5 @@
bench-nonfungible:
make _bench PALLET=nonfungible
-.PHONY: bench-evm-coder-substrate
-bench-evm-coder-substrate:
- make _bench PALLET=evm-coder-substrate
-
.PHONY: bench
-bench: bench-evm-migration bench-nft bench-fungible bench-refungible bench-nonfungible bench-evm-coder-substrate
+bench: bench-evm-migration bench-nft bench-fungible bench-refungible bench-nonfungible
crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -226,16 +226,10 @@
}
}
fn is_value(&self) -> bool {
- match self {
- Self::Plain(v) if v == "value" => true,
- _ => false,
- }
+ matches!(self, Self::Plain(v) if v == "value")
}
fn is_caller(&self) -> bool {
- match self {
- Self::Plain(v) if v == "caller" => true,
- _ => false,
- }
+ matches!(self, Self::Plain(v) if v == "caller")
}
fn is_special(&self) -> bool {
self.is_caller() || self.is_value()
@@ -599,7 +593,7 @@
#args,
)*
)?;
- (&result).into_result()
+ (&result).to_result()
}
}
}
crates/evm-coder/src/abi.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -310,7 +310,7 @@
pub trait AbiWrite {
fn abi_write(&self, writer: &mut AbiWriter);
- fn into_result(&self) -> ResultWithPostInfo<AbiWriter> {
+ fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
let mut writer = AbiWriter::new();
self.abi_write(&mut writer);
Ok(writer.into())
@@ -319,7 +319,7 @@
impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {
// this particular AbiWrite implementation should be split to another trait,
- // which only implements [`into_result`]
+ // which only implements [`to_result`]
//
// But due to lack of specialization feature in stable Rust, we can't have
// blanket impl of this trait `for T where T: AbiWrite`, so here we abusing
@@ -327,7 +327,7 @@
fn abi_write(&self, _writer: &mut AbiWriter) {
debug_assert!(false, "shouldn't be called, see comment")
}
- fn into_result(&self) -> ResultWithPostInfo<AbiWriter> {
+ fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
match self {
Ok(v) => Ok(WithPostDispatchInfo {
post_info: v.post_info.clone(),
node/rpc/src/lib.rsdiffbeforeafterboth--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -214,7 +214,7 @@
500_usize, // max stored filters
overrides.clone(),
max_past_logs,
- block_data_cache.clone(),
+ block_data_cache,
)));
}
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -51,7 +51,7 @@
Self::new_with_gas_limit(id, u64::MAX)
}
pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {
- Ok(Self::new(id).ok_or_else(|| <Error<T>>::CollectionNotFound)?)
+ Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)
}
pub fn log(&self, log: impl evm_coder::ToLog) {
self.recorder.log(log)
@@ -453,7 +453,7 @@
collection.limits.owner_can_destroy(),
<Error<T>>::NoPermission,
);
- collection.check_is_owner(&sender)?;
+ collection.check_is_owner(sender)?;
let destroyed_collections = <DestroyedCollectionCount<T>>::get()
.0
@@ -476,7 +476,7 @@
user: &T::CrossAccountId,
allowed: bool,
) -> DispatchResult {
- collection.check_is_owner_or_admin(&sender)?;
+ collection.check_is_owner_or_admin(sender)?;
// =========
@@ -495,7 +495,7 @@
user: &T::CrossAccountId,
admin: bool,
) -> DispatchResult {
- collection.check_is_owner_or_admin(&sender)?;
+ collection.check_is_owner_or_admin(sender)?;
let was_admin = <IsAdmin<T>>::get((collection.id, user));
if was_admin == admin {
pallets/evm-contract-helpers/exp.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/exp.rs
+++ b/pallets/evm-contract-helpers/exp.rs
@@ -532,11 +532,11 @@
match c.call {
InternalCall::ContractOwner { contract_address } => {
let result = self.contract_owner(contract_address)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::SponsoringEnabled { contract_address } => {
let result = self.sponsoring_enabled(contract_address)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::ToggleSponsoring {
contract_address,
@@ -544,7 +544,7 @@
} => {
let result =
self.toggle_sponsoring(c.caller.clone(), contract_address, enabled)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::SetSponsoringRateLimit {
contract_address,
@@ -555,22 +555,22 @@
contract_address,
rate_limit,
)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::GetSponsoringRateLimit { contract_address } => {
let result = self.get_sponsoring_rate_limit(contract_address)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::Allowed {
contract_address,
user,
} => {
let result = self.allowed(contract_address, user)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::AllowlistEnabled { contract_address } => {
let result = self.allowlist_enabled(contract_address)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::ToggleAllowlist {
contract_address,
@@ -578,7 +578,7 @@
} => {
let result =
self.toggle_allowlist(c.caller.clone(), contract_address, enabled)?;
- (&result).into_result()
+ (&result).to_result()
}
InternalCall::ToggleAllowed {
contract_address,
@@ -587,7 +587,7 @@
} => {
let result =
self.toggle_allowed(c.caller.clone(), contract_address, user, allowed)?;
- (&result).into_result()
+ (&result).to_result()
}
_ => ::core::panicking::panic("internal error: entered unreachable code"),
}
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -1,10 +1,7 @@
use core::marker::PhantomData;
use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use pallet_evm::{
- ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput, PrecompileResult,
- PrecompileFailure,
-};
+use pallet_evm::{ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure};
use sp_core::H160;
use crate::{
AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,
@@ -161,7 +158,7 @@
if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {
let limit = <SponsoringRateLimit<T>>::get(&call.0);
- let timeout = last_tx_block + limit.into();
+ let timeout = last_tx_block + limit;
if block_number < timeout {
return None;
}
pallets/evm-migration/src/weights.rsdiffbeforeafterboth--- a/pallets/evm-migration/src/weights.rs
+++ b/pallets/evm-migration/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
pallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -128,7 +128,7 @@
let sponsor = frame_support::storage::with_transaction(|| {
TransactionOutcome::Rollback(T::EvmSponsorshipHandler::get_sponsor(
&who,
- &(target.clone(), input.clone()),
+ &(*target, input.clone()),
))
})?;
let sponsor = T::EvmAddressMapping::into_account_id(sponsor);
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -116,7 +116,7 @@
);
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, amount),
+ <Pallet<T>>::transfer(self, &from, &to, amount),
<CommonWeights<T>>::transfer(),
)
}
@@ -134,7 +134,7 @@
);
with_weight(
- <Pallet<T>>::set_allowance(&self, &sender, &spender, amount),
+ <Pallet<T>>::set_allowance(self, &sender, &spender, amount),
<CommonWeights<T>>::approve(),
)
}
@@ -153,7 +153,7 @@
);
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount),
<CommonWeights<T>>::transfer_from(),
)
}
@@ -171,7 +171,7 @@
);
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, amount),
+ <Pallet<T>>::burn_from(self, &sender, &from, amount),
<CommonWeights<T>>::burn_from(),
)
}
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -6,7 +6,6 @@
use sp_core::{H160, U256};
use sp_std::vec::Vec;
use pallet_common::account::CrossAccountId;
-use pallet_common::erc::PrecompileOutput;
use pallet_evm_coder_substrate::{call, dispatch_to_evm};
use crate::{
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -303,8 +303,8 @@
amount: u128,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&owner)?;
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(owner)?;
+ collection.check_allowlist(spender)?;
}
if <Balance<T>>::get((collection.id, owner)) < amount {
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -32,11 +33,11 @@
/// Weight functions needed for pallet_fungible.
pub trait WeightInfo {
fn create_item() -> Weight;
- fn burn_from() -> Weight;
fn burn_item() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
+ fn burn_from() -> Weight;
}
/// Weights for pallet_fungible using the Substrate node and recommended hardware.
pallets/nft/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -158,6 +158,7 @@
sponsored_data_size: Some(0),
token_limit: Some(1),
sponsor_transfer_timeout: Some(0),
+ sponsor_approve_timeout: None,
owner_can_destroy: Some(true),
owner_can_transfer: Some(true),
sponsored_data_rate_limit: None,
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -195,7 +195,7 @@
// Create new collection
let new_collection = Collection {
- owner: who.clone(),
+ owner: who,
name: collection_name,
mode: mode.clone(),
mint_mode: false,
pallets/nft/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_nft4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2021-10-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 12889// Executed Command:10// target/release/nft11// benchmark12// --pallet13// pallet-nft14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=2022// --output=./pallets/nft/src/weights.rs232425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]2829use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;3132/// Weight functions needed for pallet_nft.33pub trait WeightInfo {34 fn create_collection() -> Weight;35 fn destroy_collection() -> Weight;36 fn add_to_allow_list() -> Weight;37 fn remove_from_allow_list() -> Weight;38 fn set_public_access_mode() -> Weight;39 fn set_mint_permission() -> Weight;40 fn change_collection_owner() -> Weight;41 fn add_collection_admin() -> Weight;42 fn remove_collection_admin() -> Weight;43 fn set_collection_sponsor() -> Weight;44 fn confirm_sponsorship() -> Weight;45 fn remove_collection_sponsor() -> Weight;46 fn set_transfers_enabled_flag() -> Weight;47 fn set_offchain_schema(b: u32, ) -> Weight;48 fn set_const_on_chain_schema(b: u32, ) -> Weight;49 fn set_variable_on_chain_schema(b: u32, ) -> Weight;50 fn set_schema_version() -> Weight;51 fn set_collection_limits() -> Weight;52 fn set_meta_update_permission_flag() -> Weight;53}5455/// Weights for pallet_nft using the Substrate node and recommended hardware.56pub struct SubstrateWeight<T>(PhantomData<T>);57impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {58 // Storage: Common CreatedCollectionCount (r:1 w:1)59 // Storage: Common DestroyedCollectionCount (r:1 w:0)60 // Storage: System Account (r:2 w:2)61 // Storage: Common CollectionById (r:0 w:1)62 fn create_collection() -> Weight {63 (23_803_000 as Weight)64 .saturating_add(T::DbWeight::get().reads(4 as Weight))65 .saturating_add(T::DbWeight::get().writes(4 as Weight))66 }67 // Storage: Common CollectionById (r:1 w:1)68 // Storage: Common DestroyedCollectionCount (r:1 w:1)69 // Storage: Nonfungible TokensMinted (r:0 w:1)70 // Storage: Nonfungible TokensBurnt (r:0 w:1)71 fn destroy_collection() -> Weight {72 (27_831_000 as Weight)73 .saturating_add(T::DbWeight::get().reads(2 as Weight))74 .saturating_add(T::DbWeight::get().writes(4 as Weight))75 }76 // Storage: Common CollectionById (r:1 w:0)77 // Storage: Common Allowlist (r:0 w:1)78 fn add_to_allow_list() -> Weight {79 (6_629_000 as Weight)80 .saturating_add(T::DbWeight::get().reads(1 as Weight))81 .saturating_add(T::DbWeight::get().writes(1 as Weight))82 }83 // Storage: Common CollectionById (r:1 w:0)84 // Storage: Common Allowlist (r:0 w:1)85 fn remove_from_allow_list() -> Weight {86 (6_596_000 as Weight)87 .saturating_add(T::DbWeight::get().reads(1 as Weight))88 .saturating_add(T::DbWeight::get().writes(1 as Weight))89 }90 // Storage: Common CollectionById (r:1 w:1)91 fn set_public_access_mode() -> Weight {92 (6_338_000 as Weight)93 .saturating_add(T::DbWeight::get().reads(1 as Weight))94 .saturating_add(T::DbWeight::get().writes(1 as Weight))95 }96 // Storage: Common CollectionById (r:1 w:1)97 fn set_mint_permission() -> Weight {98 (6_383_000 as Weight)99 .saturating_add(T::DbWeight::get().reads(1 as Weight))100 .saturating_add(T::DbWeight::get().writes(1 as Weight))101 }102 // Storage: Common CollectionById (r:1 w:1)103 fn change_collection_owner() -> Weight {104 (6_493_000 as Weight)105 .saturating_add(T::DbWeight::get().reads(1 as Weight))106 .saturating_add(T::DbWeight::get().writes(1 as Weight))107 }108 // Storage: Common CollectionById (r:1 w:0)109 // Storage: Common IsAdmin (r:0 w:1)110 fn add_collection_admin() -> Weight {111 (6_850_000 as Weight)112 .saturating_add(T::DbWeight::get().reads(1 as Weight))113 .saturating_add(T::DbWeight::get().writes(1 as Weight))114 }115 // Storage: Common CollectionById (r:1 w:0)116 // Storage: Common IsAdmin (r:0 w:1)117 fn remove_collection_admin() -> Weight {118 (6_615_000 as Weight)119 .saturating_add(T::DbWeight::get().reads(1 as Weight))120 .saturating_add(T::DbWeight::get().writes(1 as Weight))121 }122 // Storage: Common CollectionById (r:1 w:1)123 fn set_collection_sponsor() -> Weight {124 (6_430_000 as Weight)125 .saturating_add(T::DbWeight::get().reads(1 as Weight))126 .saturating_add(T::DbWeight::get().writes(1 as Weight))127 }128 // Storage: Common CollectionById (r:1 w:1)129 fn confirm_sponsorship() -> Weight {130 (6_125_000 as Weight)131 .saturating_add(T::DbWeight::get().reads(1 as Weight))132 .saturating_add(T::DbWeight::get().writes(1 as Weight))133 }134 // Storage: Common CollectionById (r:1 w:1)135 fn remove_collection_sponsor() -> Weight {136 (6_236_000 as Weight)137 .saturating_add(T::DbWeight::get().reads(1 as Weight))138 .saturating_add(T::DbWeight::get().writes(1 as Weight))139 }140 // Storage: Common CollectionById (r:1 w:1)141 fn set_transfers_enabled_flag() -> Weight {142 (6_500_000 as Weight)143 .saturating_add(T::DbWeight::get().reads(1 as Weight))144 .saturating_add(T::DbWeight::get().writes(1 as Weight))145 }146 // Storage: Common CollectionById (r:1 w:1)147 fn set_offchain_schema(_b: u32, ) -> Weight {148 (6_538_000 as Weight)149 .saturating_add(T::DbWeight::get().reads(1 as Weight))150 .saturating_add(T::DbWeight::get().writes(1 as Weight))151 }152 // Storage: Common CollectionById (r:1 w:1)153 fn set_const_on_chain_schema(_b: u32, ) -> Weight {154 (6_542_000 as Weight)155 .saturating_add(T::DbWeight::get().reads(1 as Weight))156 .saturating_add(T::DbWeight::get().writes(1 as Weight))157 }158 // Storage: Common CollectionById (r:1 w:1)159 fn set_variable_on_chain_schema(b: u32, ) -> Weight {160 (6_092_000 as Weight)161 // Standard Error: 0162 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))163 .saturating_add(T::DbWeight::get().reads(1 as Weight))164 .saturating_add(T::DbWeight::get().writes(1 as Weight))165 }166 // Storage: Common CollectionById (r:1 w:1)167 fn set_schema_version() -> Weight {168 (6_470_000 as Weight)169 .saturating_add(T::DbWeight::get().reads(1 as Weight))170 .saturating_add(T::DbWeight::get().writes(1 as Weight))171 }172 // Storage: Common CollectionById (r:1 w:1)173 fn set_collection_limits() -> Weight {174 (6_841_000 as Weight)175 .saturating_add(T::DbWeight::get().reads(1 as Weight))176 .saturating_add(T::DbWeight::get().writes(1 as Weight))177 }178 // Storage: Common CollectionById (r:1 w:1)179 fn set_meta_update_permission_flag() -> Weight {180 (6_278_000 as Weight)181 .saturating_add(T::DbWeight::get().reads(1 as Weight))182 .saturating_add(T::DbWeight::get().writes(1 as Weight))183 }184}185186// For backwards compatibility and tests187impl WeightInfo for () {188 // Storage: Common CreatedCollectionCount (r:1 w:1)189 // Storage: Common DestroyedCollectionCount (r:1 w:0)190 // Storage: System Account (r:2 w:2)191 // Storage: Common CollectionById (r:0 w:1)192 fn create_collection() -> Weight {193 (23_803_000 as Weight)194 .saturating_add(RocksDbWeight::get().reads(4 as Weight))195 .saturating_add(RocksDbWeight::get().writes(4 as Weight))196 }197 // Storage: Common CollectionById (r:1 w:1)198 // Storage: Common DestroyedCollectionCount (r:1 w:1)199 // Storage: Nonfungible TokensMinted (r:0 w:1)200 // Storage: Nonfungible TokensBurnt (r:0 w:1)201 fn destroy_collection() -> Weight {202 (27_831_000 as Weight)203 .saturating_add(RocksDbWeight::get().reads(2 as Weight))204 .saturating_add(RocksDbWeight::get().writes(4 as Weight))205 }206 // Storage: Common CollectionById (r:1 w:0)207 // Storage: Common Allowlist (r:0 w:1)208 fn add_to_allow_list() -> Weight {209 (6_629_000 as Weight)210 .saturating_add(RocksDbWeight::get().reads(1 as Weight))211 .saturating_add(RocksDbWeight::get().writes(1 as Weight))212 }213 // Storage: Common CollectionById (r:1 w:0)214 // Storage: Common Allowlist (r:0 w:1)215 fn remove_from_allow_list() -> Weight {216 (6_596_000 as Weight)217 .saturating_add(RocksDbWeight::get().reads(1 as Weight))218 .saturating_add(RocksDbWeight::get().writes(1 as Weight))219 }220 // Storage: Common CollectionById (r:1 w:1)221 fn set_public_access_mode() -> Weight {222 (6_338_000 as Weight)223 .saturating_add(RocksDbWeight::get().reads(1 as Weight))224 .saturating_add(RocksDbWeight::get().writes(1 as Weight))225 }226 // Storage: Common CollectionById (r:1 w:1)227 fn set_mint_permission() -> Weight {228 (6_383_000 as Weight)229 .saturating_add(RocksDbWeight::get().reads(1 as Weight))230 .saturating_add(RocksDbWeight::get().writes(1 as Weight))231 }232 // Storage: Common CollectionById (r:1 w:1)233 fn change_collection_owner() -> Weight {234 (6_493_000 as Weight)235 .saturating_add(RocksDbWeight::get().reads(1 as Weight))236 .saturating_add(RocksDbWeight::get().writes(1 as Weight))237 }238 // Storage: Common CollectionById (r:1 w:0)239 // Storage: Common IsAdmin (r:0 w:1)240 fn add_collection_admin() -> Weight {241 (6_850_000 as Weight)242 .saturating_add(RocksDbWeight::get().reads(1 as Weight))243 .saturating_add(RocksDbWeight::get().writes(1 as Weight))244 }245 // Storage: Common CollectionById (r:1 w:0)246 // Storage: Common IsAdmin (r:0 w:1)247 fn remove_collection_admin() -> Weight {248 (6_615_000 as Weight)249 .saturating_add(RocksDbWeight::get().reads(1 as Weight))250 .saturating_add(RocksDbWeight::get().writes(1 as Weight))251 }252 // Storage: Common CollectionById (r:1 w:1)253 fn set_collection_sponsor() -> Weight {254 (6_430_000 as Weight)255 .saturating_add(RocksDbWeight::get().reads(1 as Weight))256 .saturating_add(RocksDbWeight::get().writes(1 as Weight))257 }258 // Storage: Common CollectionById (r:1 w:1)259 fn confirm_sponsorship() -> Weight {260 (6_125_000 as Weight)261 .saturating_add(RocksDbWeight::get().reads(1 as Weight))262 .saturating_add(RocksDbWeight::get().writes(1 as Weight))263 }264 // Storage: Common CollectionById (r:1 w:1)265 fn remove_collection_sponsor() -> Weight {266 (6_236_000 as Weight)267 .saturating_add(RocksDbWeight::get().reads(1 as Weight))268 .saturating_add(RocksDbWeight::get().writes(1 as Weight))269 }270 // Storage: Common CollectionById (r:1 w:1)271 fn set_transfers_enabled_flag() -> Weight {272 (6_500_000 as Weight)273 .saturating_add(RocksDbWeight::get().reads(1 as Weight))274 .saturating_add(RocksDbWeight::get().writes(1 as Weight))275 }276 // Storage: Common CollectionById (r:1 w:1)277 fn set_offchain_schema(_b: u32, ) -> Weight {278 (6_538_000 as Weight)279 .saturating_add(RocksDbWeight::get().reads(1 as Weight))280 .saturating_add(RocksDbWeight::get().writes(1 as Weight))281 }282 // Storage: Common CollectionById (r:1 w:1)283 fn set_const_on_chain_schema(_b: u32, ) -> Weight {284 (6_542_000 as Weight)285 .saturating_add(RocksDbWeight::get().reads(1 as Weight))286 .saturating_add(RocksDbWeight::get().writes(1 as Weight))287 }288 // Storage: Common CollectionById (r:1 w:1)289 fn set_variable_on_chain_schema(b: u32, ) -> Weight {290 (6_092_000 as Weight)291 // Standard Error: 0292 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))293 .saturating_add(RocksDbWeight::get().reads(1 as Weight))294 .saturating_add(RocksDbWeight::get().writes(1 as Weight))295 }296 // Storage: Common CollectionById (r:1 w:1)297 fn set_schema_version() -> Weight {298 (6_470_000 as Weight)299 .saturating_add(RocksDbWeight::get().reads(1 as Weight))300 .saturating_add(RocksDbWeight::get().writes(1 as Weight))301 }302 // Storage: Common CollectionById (r:1 w:1)303 fn set_collection_limits() -> Weight {304 (6_841_000 as Weight)305 .saturating_add(RocksDbWeight::get().reads(1 as Weight))306 .saturating_add(RocksDbWeight::get().writes(1 as Weight))307 }308 // Storage: Common CollectionById (r:1 w:1)309 fn set_meta_update_permission_flag() -> Weight {310 (6_278_000 as Weight)311 .saturating_add(RocksDbWeight::get().reads(1 as Weight))312 .saturating_add(RocksDbWeight::get().writes(1 as Weight))313 }314}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_nft4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2021-10-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 12889// Executed Command:10// target/release/nft11// benchmark12// --pallet13// pallet-nft14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=2022// --output=./pallets/nft/src/weights.rs232425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]2930use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use sp_std::marker::PhantomData;3233/// Weight functions needed for pallet_nft.34pub trait WeightInfo {35 fn create_collection() -> Weight;36 fn destroy_collection() -> Weight;37 fn add_to_allow_list() -> Weight;38 fn remove_from_allow_list() -> Weight;39 fn set_public_access_mode() -> Weight;40 fn set_mint_permission() -> Weight;41 fn change_collection_owner() -> Weight;42 fn add_collection_admin() -> Weight;43 fn remove_collection_admin() -> Weight;44 fn set_collection_sponsor() -> Weight;45 fn confirm_sponsorship() -> Weight;46 fn remove_collection_sponsor() -> Weight;47 fn set_transfers_enabled_flag() -> Weight;48 fn set_offchain_schema(b: u32, ) -> Weight;49 fn set_const_on_chain_schema(b: u32, ) -> Weight;50 fn set_variable_on_chain_schema(b: u32, ) -> Weight;51 fn set_schema_version() -> Weight;52 fn set_collection_limits() -> Weight;53 fn set_meta_update_permission_flag() -> Weight;54}5556/// Weights for pallet_nft using the Substrate node and recommended hardware.57pub struct SubstrateWeight<T>(PhantomData<T>);58impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {59 // Storage: Common CreatedCollectionCount (r:1 w:1)60 // Storage: Common DestroyedCollectionCount (r:1 w:0)61 // Storage: System Account (r:2 w:2)62 // Storage: Common CollectionById (r:0 w:1)63 fn create_collection() -> Weight {64 (23_803_000 as Weight)65 .saturating_add(T::DbWeight::get().reads(4 as Weight))66 .saturating_add(T::DbWeight::get().writes(4 as Weight))67 }68 // Storage: Common CollectionById (r:1 w:1)69 // Storage: Common DestroyedCollectionCount (r:1 w:1)70 // Storage: Nonfungible TokensMinted (r:0 w:1)71 // Storage: Nonfungible TokensBurnt (r:0 w:1)72 fn destroy_collection() -> Weight {73 (27_831_000 as Weight)74 .saturating_add(T::DbWeight::get().reads(2 as Weight))75 .saturating_add(T::DbWeight::get().writes(4 as Weight))76 }77 // Storage: Common CollectionById (r:1 w:0)78 // Storage: Common Allowlist (r:0 w:1)79 fn add_to_allow_list() -> Weight {80 (6_629_000 as Weight)81 .saturating_add(T::DbWeight::get().reads(1 as Weight))82 .saturating_add(T::DbWeight::get().writes(1 as Weight))83 }84 // Storage: Common CollectionById (r:1 w:0)85 // Storage: Common Allowlist (r:0 w:1)86 fn remove_from_allow_list() -> Weight {87 (6_596_000 as Weight)88 .saturating_add(T::DbWeight::get().reads(1 as Weight))89 .saturating_add(T::DbWeight::get().writes(1 as Weight))90 }91 // Storage: Common CollectionById (r:1 w:1)92 fn set_public_access_mode() -> Weight {93 (6_338_000 as Weight)94 .saturating_add(T::DbWeight::get().reads(1 as Weight))95 .saturating_add(T::DbWeight::get().writes(1 as Weight))96 }97 // Storage: Common CollectionById (r:1 w:1)98 fn set_mint_permission() -> Weight {99 (6_383_000 as Weight)100 .saturating_add(T::DbWeight::get().reads(1 as Weight))101 .saturating_add(T::DbWeight::get().writes(1 as Weight))102 }103 // Storage: Common CollectionById (r:1 w:1)104 fn change_collection_owner() -> Weight {105 (6_493_000 as Weight)106 .saturating_add(T::DbWeight::get().reads(1 as Weight))107 .saturating_add(T::DbWeight::get().writes(1 as Weight))108 }109 // Storage: Common CollectionById (r:1 w:0)110 // Storage: Common IsAdmin (r:0 w:1)111 fn add_collection_admin() -> Weight {112 (6_850_000 as Weight)113 .saturating_add(T::DbWeight::get().reads(1 as Weight))114 .saturating_add(T::DbWeight::get().writes(1 as Weight))115 }116 // Storage: Common CollectionById (r:1 w:0)117 // Storage: Common IsAdmin (r:0 w:1)118 fn remove_collection_admin() -> Weight {119 (6_615_000 as Weight)120 .saturating_add(T::DbWeight::get().reads(1 as Weight))121 .saturating_add(T::DbWeight::get().writes(1 as Weight))122 }123 // Storage: Common CollectionById (r:1 w:1)124 fn set_collection_sponsor() -> Weight {125 (6_430_000 as Weight)126 .saturating_add(T::DbWeight::get().reads(1 as Weight))127 .saturating_add(T::DbWeight::get().writes(1 as Weight))128 }129 // Storage: Common CollectionById (r:1 w:1)130 fn confirm_sponsorship() -> Weight {131 (6_125_000 as Weight)132 .saturating_add(T::DbWeight::get().reads(1 as Weight))133 .saturating_add(T::DbWeight::get().writes(1 as Weight))134 }135 // Storage: Common CollectionById (r:1 w:1)136 fn remove_collection_sponsor() -> Weight {137 (6_236_000 as Weight)138 .saturating_add(T::DbWeight::get().reads(1 as Weight))139 .saturating_add(T::DbWeight::get().writes(1 as Weight))140 }141 // Storage: Common CollectionById (r:1 w:1)142 fn set_transfers_enabled_flag() -> Weight {143 (6_500_000 as Weight)144 .saturating_add(T::DbWeight::get().reads(1 as Weight))145 .saturating_add(T::DbWeight::get().writes(1 as Weight))146 }147 // Storage: Common CollectionById (r:1 w:1)148 fn set_offchain_schema(_b: u32, ) -> Weight {149 (6_538_000 as Weight)150 .saturating_add(T::DbWeight::get().reads(1 as Weight))151 .saturating_add(T::DbWeight::get().writes(1 as Weight))152 }153 // Storage: Common CollectionById (r:1 w:1)154 fn set_const_on_chain_schema(_b: u32, ) -> Weight {155 (6_542_000 as Weight)156 .saturating_add(T::DbWeight::get().reads(1 as Weight))157 .saturating_add(T::DbWeight::get().writes(1 as Weight))158 }159 // Storage: Common CollectionById (r:1 w:1)160 fn set_variable_on_chain_schema(b: u32, ) -> Weight {161 (6_092_000 as Weight)162 // Standard Error: 0163 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))164 .saturating_add(T::DbWeight::get().reads(1 as Weight))165 .saturating_add(T::DbWeight::get().writes(1 as Weight))166 }167 // Storage: Common CollectionById (r:1 w:1)168 fn set_schema_version() -> Weight {169 (6_470_000 as Weight)170 .saturating_add(T::DbWeight::get().reads(1 as Weight))171 .saturating_add(T::DbWeight::get().writes(1 as Weight))172 }173 // Storage: Common CollectionById (r:1 w:1)174 fn set_collection_limits() -> Weight {175 (6_841_000 as Weight)176 .saturating_add(T::DbWeight::get().reads(1 as Weight))177 .saturating_add(T::DbWeight::get().writes(1 as Weight))178 }179 // Storage: Common CollectionById (r:1 w:1)180 fn set_meta_update_permission_flag() -> Weight {181 (6_278_000 as Weight)182 .saturating_add(T::DbWeight::get().reads(1 as Weight))183 .saturating_add(T::DbWeight::get().writes(1 as Weight))184 }185}186187// For backwards compatibility and tests188impl WeightInfo for () {189 // Storage: Common CreatedCollectionCount (r:1 w:1)190 // Storage: Common DestroyedCollectionCount (r:1 w:0)191 // Storage: System Account (r:2 w:2)192 // Storage: Common CollectionById (r:0 w:1)193 fn create_collection() -> Weight {194 (23_803_000 as Weight)195 .saturating_add(RocksDbWeight::get().reads(4 as Weight))196 .saturating_add(RocksDbWeight::get().writes(4 as Weight))197 }198 // Storage: Common CollectionById (r:1 w:1)199 // Storage: Common DestroyedCollectionCount (r:1 w:1)200 // Storage: Nonfungible TokensMinted (r:0 w:1)201 // Storage: Nonfungible TokensBurnt (r:0 w:1)202 fn destroy_collection() -> Weight {203 (27_831_000 as Weight)204 .saturating_add(RocksDbWeight::get().reads(2 as Weight))205 .saturating_add(RocksDbWeight::get().writes(4 as Weight))206 }207 // Storage: Common CollectionById (r:1 w:0)208 // Storage: Common Allowlist (r:0 w:1)209 fn add_to_allow_list() -> Weight {210 (6_629_000 as Weight)211 .saturating_add(RocksDbWeight::get().reads(1 as Weight))212 .saturating_add(RocksDbWeight::get().writes(1 as Weight))213 }214 // Storage: Common CollectionById (r:1 w:0)215 // Storage: Common Allowlist (r:0 w:1)216 fn remove_from_allow_list() -> Weight {217 (6_596_000 as Weight)218 .saturating_add(RocksDbWeight::get().reads(1 as Weight))219 .saturating_add(RocksDbWeight::get().writes(1 as Weight))220 }221 // Storage: Common CollectionById (r:1 w:1)222 fn set_public_access_mode() -> Weight {223 (6_338_000 as Weight)224 .saturating_add(RocksDbWeight::get().reads(1 as Weight))225 .saturating_add(RocksDbWeight::get().writes(1 as Weight))226 }227 // Storage: Common CollectionById (r:1 w:1)228 fn set_mint_permission() -> Weight {229 (6_383_000 as Weight)230 .saturating_add(RocksDbWeight::get().reads(1 as Weight))231 .saturating_add(RocksDbWeight::get().writes(1 as Weight))232 }233 // Storage: Common CollectionById (r:1 w:1)234 fn change_collection_owner() -> Weight {235 (6_493_000 as Weight)236 .saturating_add(RocksDbWeight::get().reads(1 as Weight))237 .saturating_add(RocksDbWeight::get().writes(1 as Weight))238 }239 // Storage: Common CollectionById (r:1 w:0)240 // Storage: Common IsAdmin (r:0 w:1)241 fn add_collection_admin() -> Weight {242 (6_850_000 as Weight)243 .saturating_add(RocksDbWeight::get().reads(1 as Weight))244 .saturating_add(RocksDbWeight::get().writes(1 as Weight))245 }246 // Storage: Common CollectionById (r:1 w:0)247 // Storage: Common IsAdmin (r:0 w:1)248 fn remove_collection_admin() -> Weight {249 (6_615_000 as Weight)250 .saturating_add(RocksDbWeight::get().reads(1 as Weight))251 .saturating_add(RocksDbWeight::get().writes(1 as Weight))252 }253 // Storage: Common CollectionById (r:1 w:1)254 fn set_collection_sponsor() -> Weight {255 (6_430_000 as Weight)256 .saturating_add(RocksDbWeight::get().reads(1 as Weight))257 .saturating_add(RocksDbWeight::get().writes(1 as Weight))258 }259 // Storage: Common CollectionById (r:1 w:1)260 fn confirm_sponsorship() -> Weight {261 (6_125_000 as Weight)262 .saturating_add(RocksDbWeight::get().reads(1 as Weight))263 .saturating_add(RocksDbWeight::get().writes(1 as Weight))264 }265 // Storage: Common CollectionById (r:1 w:1)266 fn remove_collection_sponsor() -> Weight {267 (6_236_000 as Weight)268 .saturating_add(RocksDbWeight::get().reads(1 as Weight))269 .saturating_add(RocksDbWeight::get().writes(1 as Weight))270 }271 // Storage: Common CollectionById (r:1 w:1)272 fn set_transfers_enabled_flag() -> Weight {273 (6_500_000 as Weight)274 .saturating_add(RocksDbWeight::get().reads(1 as Weight))275 .saturating_add(RocksDbWeight::get().writes(1 as Weight))276 }277 // Storage: Common CollectionById (r:1 w:1)278 fn set_offchain_schema(_b: u32, ) -> Weight {279 (6_538_000 as Weight)280 .saturating_add(RocksDbWeight::get().reads(1 as Weight))281 .saturating_add(RocksDbWeight::get().writes(1 as Weight))282 }283 // Storage: Common CollectionById (r:1 w:1)284 fn set_const_on_chain_schema(_b: u32, ) -> Weight {285 (6_542_000 as Weight)286 .saturating_add(RocksDbWeight::get().reads(1 as Weight))287 .saturating_add(RocksDbWeight::get().writes(1 as Weight))288 }289 // Storage: Common CollectionById (r:1 w:1)290 fn set_variable_on_chain_schema(b: u32, ) -> Weight {291 (6_092_000 as Weight)292 // Standard Error: 0293 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))294 .saturating_add(RocksDbWeight::get().reads(1 as Weight))295 .saturating_add(RocksDbWeight::get().writes(1 as Weight))296 }297 // Storage: Common CollectionById (r:1 w:1)298 fn set_schema_version() -> Weight {299 (6_470_000 as Weight)300 .saturating_add(RocksDbWeight::get().reads(1 as Weight))301 .saturating_add(RocksDbWeight::get().writes(1 as Weight))302 }303 // Storage: Common CollectionById (r:1 w:1)304 fn set_collection_limits() -> Weight {305 (6_841_000 as Weight)306 .saturating_add(RocksDbWeight::get().reads(1 as Weight))307 .saturating_add(RocksDbWeight::get().writes(1 as Weight))308 }309 // Storage: Common CollectionById (r:1 w:1)310 fn set_meta_update_permission_flag() -> Weight {311 (6_278_000 as Weight)312 .saturating_add(RocksDbWeight::get().reads(1 as Weight))313 .saturating_add(RocksDbWeight::get().writes(1 as Weight))314 }315}pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -100,7 +100,7 @@
ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
if amount == 1 {
with_weight(
- <Pallet<T>>::burn(&self, &sender, token),
+ <Pallet<T>>::burn(self, &sender, token),
<CommonWeights<T>>::burn_item(),
)
} else {
@@ -118,7 +118,7 @@
ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
if amount == 1 {
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, token),
+ <Pallet<T>>::transfer(self, &from, &to, token),
<CommonWeights<T>>::transfer(),
)
} else {
@@ -137,9 +137,9 @@
with_weight(
if amount == 1 {
- <Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))
+ <Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))
} else {
- <Pallet<T>>::set_allowance(&self, &sender, token, None)
+ <Pallet<T>>::set_allowance(self, &sender, token, None)
},
<CommonWeights<T>>::approve(),
)
@@ -157,7 +157,7 @@
if amount == 1 {
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, token),
<CommonWeights<T>>::transfer_from(),
)
} else {
@@ -176,7 +176,7 @@
if amount == 1 {
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, token),
+ <Pallet<T>>::burn_from(self, &sender, &from, token),
<CommonWeights<T>>::burn_from(),
)
} else {
@@ -192,7 +192,7 @@
) -> DispatchResultWithPostInfo {
let len = data.len();
with_weight(
- <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+ <Pallet<T>>::set_variable_metadata(self, &sender, token, data),
<CommonWeights<T>>::set_variable_metadata(len as u32),
)
}
@@ -218,12 +218,12 @@
}
fn const_metadata(&self, token: TokenId) -> Vec<u8> {
<TokenData<T>>::get((self.id, token))
- .map(|t| t.const_data.clone())
+ .map(|t| t.const_data)
.unwrap_or_default()
}
fn variable_metadata(&self, token: TokenId) -> Vec<u8> {
<TokenData<T>>::get((self.id, token))
- .map(|t| t.variable_data.clone())
+ .map(|t| t.variable_data)
.unwrap_or_default()
}
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -13,7 +13,6 @@
erc::{CommonEvmHandler, PrecompileResult},
};
use pallet_evm_coder_substrate::call;
-use pallet_common::erc::PrecompileOutput;
use crate::{
AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -169,8 +169,8 @@
sender: &T::CrossAccountId,
token: TokenId,
) -> DispatchResult {
- let token_data = <TokenData<T>>::get((collection.id, token))
- .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+ let token_data =
+ <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
ensure!(
&token_data.owner == sender
|| (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(sender)),
@@ -197,7 +197,7 @@
collection.id,
token,
sender.clone(),
- old_spender.clone(),
+ old_spender,
0,
));
}
@@ -213,7 +213,7 @@
token_data.owner,
1,
));
- return Ok(());
+ Ok(())
}
pub fn transfer(
@@ -227,8 +227,8 @@
<CommonError<T>>::TransferNotAllowed
);
- let token_data = <TokenData<T>>::get((collection.id, token))
- .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+ let token_data =
+ <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
ensure!(
&token_data.owner == from
|| (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(from)),
@@ -399,7 +399,7 @@
collection.id,
token,
sender.clone(),
- old_owner.clone(),
+ old_owner,
0,
));
}
@@ -429,7 +429,7 @@
collection.id,
token,
sender.clone(),
- old_spender.clone(),
+ old_spender,
0,
));
}
@@ -443,9 +443,9 @@
spender: Option<&T::CrossAccountId>,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&sender)?;
+ collection.check_allowlist(sender)?;
if let Some(spender) = spender {
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(spender)?;
}
}
@@ -491,7 +491,7 @@
// =========
- Self::transfer(collection, &from, to, token)?;
+ Self::transfer(collection, from, to, token)?;
// Allowance is reset in [`transfer`]
Ok(())
}
@@ -519,7 +519,7 @@
// =========
- Self::burn(collection, &from, token)
+ Self::burn(collection, from, token)
}
pub fn set_variable_metadata(
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -33,11 +34,11 @@
pub trait WeightInfo {
fn create_item() -> Weight;
fn create_multiple_items(b: u32, ) -> Weight;
- fn burn_from() -> Weight;
fn burn_item() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
+ fn burn_from() -> Weight;
fn set_variable_metadata(b: u32, ) -> Weight;
}
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -135,7 +135,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, token, amount),
+ <Pallet<T>>::transfer(self, &from, &to, token, amount),
<CommonWeights<T>>::transfer(),
)
}
@@ -148,7 +148,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::set_allowance(&self, &sender, &spender, token, amount),
+ <Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),
<CommonWeights<T>>::approve(),
)
}
@@ -162,7 +162,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token, amount),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount),
<CommonWeights<T>>::transfer_from(),
)
}
@@ -175,7 +175,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, token, amount),
+ <Pallet<T>>::burn_from(self, &sender, &from, token, amount),
<CommonWeights<T>>::burn_from(),
)
}
@@ -188,7 +188,7 @@
) -> DispatchResultWithPostInfo {
let len = data.len();
with_weight(
- <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+ <Pallet<T>>::set_variable_metadata(self, &sender, token, data),
<CommonWeights<T>>::set_variable_metadata(len as u32),
)
}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -189,7 +189,7 @@
<Balance<T>>::remove_prefix((collection.id, token_id), None);
<Allowance<T>>::remove_prefix((collection.id, token_id), None);
// TODO: ERC721 transfer event
- return Ok(());
+ Ok(())
}
pub fn burn(
@@ -367,8 +367,8 @@
collection.check_allowlist(sender)?;
for item in data.iter() {
- for (user, _) in &item.users {
- collection.check_allowlist(&user)?;
+ for user in item.users.keys() {
+ collection.check_allowlist(user)?;
}
}
}
@@ -409,7 +409,7 @@
let mut balances = BTreeMap::new();
for data in &data {
- for (owner, _) in &data.users {
+ for owner in data.users.keys() {
let balance = balances
.entry(owner)
.or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));
@@ -483,8 +483,8 @@
amount: u128,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&sender)?;
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(sender)?;
+ collection.check_allowlist(spender)?;
}
<PalletCommon<T>>::ensure_correct_receiver(spender)?;
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -33,7 +34,6 @@
pub trait WeightInfo {
fn create_item() -> Weight;
fn create_multiple_items(b: u32, ) -> Weight;
- fn burn_from() -> Weight;
fn burn_item_partial() -> Weight;
fn burn_item_fully() -> Weight;
fn transfer_normal() -> Weight;
@@ -45,6 +45,7 @@
fn transfer_from_creating() -> Weight;
fn transfer_from_removing() -> Weight;
fn transfer_from_creating_removing() -> Weight;
+ fn burn_from() -> Weight;
fn set_variable_metadata(b: u32, ) -> Weight;
}
primitives/nft/src/lib.rsdiffbeforeafterboth--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -327,8 +327,7 @@
D: ser::Serializer,
V: Serialize,
{
- let vec: &Vec<_> = &value;
- vec.serialize(serializer)
+ (value as &Vec<_>).serialize(serializer)
}
pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -1177,6 +1177,7 @@
EVM::account_storages(address, H256::from_slice(&tmp[..]))
}
+ #[allow(clippy::redundant_closure)]
fn call(
from: H160,
to: H160,
@@ -1207,6 +1208,7 @@
).map_err(|err| err.into())
}
+ #[allow(clippy::redundant_closure)]
fn create(
from: H160,
data: Vec<u8>,