git.delta.rocks / unique-network / refs/commits / fbd66f575db9

difftreelog

ci fix clippy warnings

Yaroslav Bolyukin2021-06-28parent: #93b1982.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5996,34 +5996,34 @@
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
-source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
+ "serde",
+ "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
+ "substrate-test-utils",
+ "up-sponsorship",
 ]
 
 [[package]]
 name = "pallet-scheduler"
 version = "3.0.0"
+source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.3#c94e0cdfe5556680dca1996004751eeb114755d7"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
  "parity-scale-codec 2.1.3",
- "serde",
- "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
- "substrate-test-utils",
- "up-sponsorship",
 ]
 
 [[package]]
modifiedcrates/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
@@ -264,7 +264,7 @@
 			ReturnType::Type(_, ty) => ty,
 			_ => return Err(syn::Error::new(value.sig.output.span(), "interface method should return Result<value>\nif there is no value to return - specify void (which is alias to unit)")),
 		};
-		let result = parse_result_ok(&result)?;
+		let result = parse_result_ok(result)?;
 
 		let camel_name = info
 			.rename_selector
@@ -285,8 +285,8 @@
 		Ok(Self {
 			name: ident.clone(),
 			camel_name,
-			pascal_name: snake_ident_to_pascal(&ident),
-			screaming_name: snake_ident_to_screaming(&ident),
+			pascal_name: snake_ident_to_pascal(ident),
+			screaming_name: snake_ident_to_screaming(ident),
 			selector_str,
 			selector,
 			args,
@@ -433,7 +433,7 @@
 						found_error = true;
 					}
 				}
-				TraitItem::Method(method) => methods.push(Method::try_from(&method)?),
+				TraitItem::Method(method) => methods.push(Method::try_from(method)?),
 				_ => {}
 			}
 		}
modifiedcrates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/to_log.rs
+++ b/crates/evm-coder-macros/src/to_log.rs
@@ -41,7 +41,7 @@
 impl Event {
 	fn try_from(variant: &Variant) -> syn::Result<Self> {
 		let name = &variant.ident;
-		let name_screaming = snake_ident_to_screaming(&name);
+		let name_screaming = snake_ident_to_screaming(name);
 
 		let named = match &variant.fields {
 			Fields::Named(named) => named,
@@ -54,7 +54,7 @@
 		};
 		let mut fields = Vec::new();
 		for field in &named.named {
-			fields.push(EventField::try_from(&field)?);
+			fields.push(EventField::try_from(field)?);
 		}
 		let mut selector_str = format!("{}(", name);
 		for (i, arg) in fields.iter().enumerate() {
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
before · crates/evm-coder/src/abi.rs
1//! TODO: I misunterstood therminology, abi IS rlp encoded, so2//! this module should be replaced with rlp crate34#![allow(dead_code)]56#[cfg(not(feature = "std"))]7use alloc::{8	string::{String, ToString},9	vec::Vec,10};11use primitive_types::{H160, U256};1213use crate::types::string;1415const ABI_ALIGNMENT: usize = 32;1617pub type Result<T> = core::result::Result<T, &'static str>;1819#[derive(Clone)]20pub struct AbiReader<'i> {21	buf: &'i [u8],22	offset: usize,23}24impl<'i> AbiReader<'i> {25	pub fn new(buf: &'i [u8]) -> Self {26		Self { buf, offset: 0 }27	}28	pub fn new_call(buf: &'i [u8]) -> Result<(u32, Self)> {29		if buf.len() < 4 {30			return Err("missing method id");31		}32		let mut method_id = [0; 4];33		method_id.copy_from_slice(&buf[0..4]);3435		Ok((u32::from_be_bytes(method_id), Self { buf, offset: 4 }))36	}3738	fn read_padleft<const S: usize>(&mut self) -> Result<[u8; S]> {39		if self.buf.len() - self.offset < 32 {40			return Err("missing padding");41		}42		let mut block = [0; S];43		// Verify padding is empty44		if !self.buf[self.offset..self.offset + ABI_ALIGNMENT - S]45			.iter()46			.all(|&v| v == 0)47		{48			return Err("non zero padding (wrong types?)");49		}50		block.copy_from_slice(51			&self.buf[self.offset + ABI_ALIGNMENT - S..self.offset + ABI_ALIGNMENT],52		);53		self.offset += ABI_ALIGNMENT;54		Ok(block)55	}5657	pub fn address(&mut self) -> Result<H160> {58		Ok(H160(self.read_padleft()?))59	}6061	pub fn bool(&mut self) -> Result<bool> {62		let data: [u8; 1] = self.read_padleft()?;63		match data[0] {64			0 => Ok(false),65			1 => Ok(true),66			_ => Err("wrong bool value"),67		}68	}6970	pub fn bytes4(&mut self) -> Result<[u8; 4]> {71		self.read_padleft()72	}7374	pub fn bytes(&mut self) -> Result<Vec<u8>> {75		let mut subresult = self.subresult()?;76		let length = subresult.read_usize()?;77		if subresult.buf.len() <= subresult.offset + length {78			return Err("bytes out of bounds");79		}80		Ok(subresult.buf[subresult.offset..subresult.offset + length].into())81	}8283	pub fn uint32(&mut self) -> Result<u32> {84		Ok(u32::from_be_bytes(self.read_padleft()?))85	}8687	pub fn uint128(&mut self) -> Result<u128> {88		Ok(u128::from_be_bytes(self.read_padleft()?))89	}9091	pub fn uint256(&mut self) -> Result<U256> {92		let buf: [u8; 32] = self.read_padleft()?;93		Ok(U256::from_big_endian(&buf))94	}9596	pub fn uint64(&mut self) -> Result<u64> {97		Ok(u64::from_be_bytes(self.read_padleft()?))98	}99100	pub fn read_usize(&mut self) -> Result<usize> {101		Ok(usize::from_be_bytes(self.read_padleft()?))102	}103104	fn subresult(&mut self) -> Result<AbiReader<'i>> {105		let offset = self.read_usize()?;106		Ok(AbiReader {107			buf: &self.buf,108			offset: offset + self.offset,109		})110	}111112	pub fn is_finished(&self) -> bool {113		self.buf.len() == self.offset114	}115}116117#[derive(Default)]118pub struct AbiWriter {119	static_part: Vec<u8>,120	dynamic_part: Vec<(usize, AbiWriter)>,121}122impl AbiWriter {123	pub fn new() -> Self {124		Self::default()125	}126	pub fn new_call(method_id: u32) -> Self {127		let mut val = Self::new();128		val.static_part.extend(&method_id.to_be_bytes());129		val130	}131132	fn write_padleft(&mut self, block: &[u8]) {133		assert!(block.len() <= ABI_ALIGNMENT);134		self.static_part135			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);136		self.static_part.extend(block);137	}138139	fn write_padright(&mut self, bytes: &[u8]) {140		assert!(bytes.len() <= ABI_ALIGNMENT);141		self.static_part.extend(bytes);142		self.static_part143			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - bytes.len()]);144	}145146	pub fn address(&mut self, address: &H160) {147		self.write_padleft(&address.0)148	}149150	pub fn bool(&mut self, value: &bool) {151		self.write_padleft(&[if *value { 1 } else { 0 }])152	}153154	pub fn uint8(&mut self, value: &u8) {155		self.write_padleft(&[*value])156	}157158	pub fn uint32(&mut self, value: &u32) {159		self.write_padleft(&u32::to_be_bytes(*value))160	}161162	pub fn uint128(&mut self, value: &u128) {163		self.write_padleft(&u128::to_be_bytes(*value))164	}165166	/// This method writes u128, and exists only for convenience, because there is167	/// no u256 support in rust168	pub fn uint256(&mut self, value: &U256) {169		let mut out = [0; 32];170		value.to_big_endian(&mut out);171		self.write_padleft(&out)172	}173174	pub fn write_usize(&mut self, value: &usize) {175		self.write_padleft(&usize::to_be_bytes(*value))176	}177178	pub fn write_subresult(&mut self, result: Self) {179		self.dynamic_part.push((self.static_part.len(), result));180		// Empty block, to be filled later181		self.write_padleft(&[]);182	}183184	pub fn memory(&mut self, value: &[u8]) {185		let mut sub = Self::new();186		sub.write_usize(&value.len());187		for chunk in value.chunks(ABI_ALIGNMENT) {188			sub.write_padright(chunk);189		}190		self.write_subresult(sub);191	}192193	pub fn string(&mut self, value: &str) {194		self.memory(value.as_bytes())195	}196197	pub fn finish(mut self) -> Vec<u8> {198		for (static_offset, part) in self.dynamic_part {199			let part_offset = self.static_part.len();200201			let encoded_dynamic_offset = usize::to_be_bytes(part_offset - static_offset);202			self.static_part[static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len()203				..static_offset + ABI_ALIGNMENT]204				.copy_from_slice(&encoded_dynamic_offset);205			self.static_part.extend(part.finish())206		}207		self.static_part208	}209}210211pub trait AbiRead<T> {212	fn abi_read(&mut self) -> Result<T>;213}214215macro_rules! impl_abi_readable {216	($ty:ty, $method:ident) => {217		impl AbiRead<$ty> for AbiReader<'_> {218			fn abi_read(&mut self) -> Result<$ty> {219				self.$method()220			}221		}222	};223}224225impl_abi_readable!(u32, uint32);226impl_abi_readable!(u128, uint128);227impl_abi_readable!(U256, uint256);228impl_abi_readable!(H160, address);229impl_abi_readable!(Vec<u8>, bytes);230impl_abi_readable!(bool, bool);231232pub trait AbiWrite {233	fn abi_write(&self, writer: &mut AbiWriter);234}235236macro_rules! impl_abi_writeable {237	($ty:ty, $method:ident) => {238		impl AbiWrite for $ty {239			fn abi_write(&self, writer: &mut AbiWriter) {240				writer.$method(&self)241			}242		}243	};244}245246impl_abi_writeable!(u8, uint8);247impl_abi_writeable!(u32, uint32);248impl_abi_writeable!(u128, uint128);249impl_abi_writeable!(U256, uint256);250impl_abi_writeable!(H160, address);251impl_abi_writeable!(bool, bool);252impl_abi_writeable!(&str, string);253impl AbiWrite for &string {254	fn abi_write(&self, writer: &mut AbiWriter) {255		writer.string(&self)256	}257}258259impl AbiWrite for () {260	fn abi_write(&self, _writer: &mut AbiWriter) {}261}262263/// Error, which can be constructed from any ToString type264/// Encoded to Abi as Error(string)265#[derive(Debug)]266pub struct StringError(String);267268impl<E> From<E> for StringError269where270	E: ToString,271{272	fn from(e: E) -> Self {273		Self(e.to_string())274	}275}276277impl From<StringError> for AbiWriter {278	fn from(v: StringError) -> Self {279		let mut out = AbiWriter::new_call(crate::fn_selector!(Error(string)));280		out.string(&v.0);281		out282	}283}284285#[macro_export]286macro_rules! abi_decode {287	($reader:expr, $($name:ident: $typ:ident),+ $(,)?) => {288		$(289			let $name = $reader.$typ()?;290		)+291	}292}293#[macro_export]294macro_rules! abi_encode {295	($($typ:ident($value:expr)),* $(,)?) => {{296		#[allow(unused_mut)]297		let mut writer = ::evm_coder::abi::AbiWriter::new();298		$(299			writer.$typ($value);300		)*301		writer302	}};303	(call $val:expr; $($typ:ident($value:expr)),* $(,)?) => {{304		#[allow(unused_mut)]305		let mut writer = ::evm_coder::abi::AbiWriter::new_call($val);306		$(307			writer.$typ($value);308		)*309		writer310	}}311}
after · crates/evm-coder/src/abi.rs
1//! TODO: I misunterstood therminology, abi IS rlp encoded, so2//! this module should be replaced with rlp crate34#![allow(dead_code)]56#[cfg(not(feature = "std"))]7use alloc::{8	string::{String, ToString},9	vec::Vec,10};11use primitive_types::{H160, U256};1213use crate::types::string;1415const ABI_ALIGNMENT: usize = 32;1617pub type Result<T> = core::result::Result<T, &'static str>;1819#[derive(Clone)]20pub struct AbiReader<'i> {21	buf: &'i [u8],22	offset: usize,23}24impl<'i> AbiReader<'i> {25	pub fn new(buf: &'i [u8]) -> Self {26		Self { buf, offset: 0 }27	}28	pub fn new_call(buf: &'i [u8]) -> Result<(u32, Self)> {29		if buf.len() < 4 {30			return Err("missing method id");31		}32		let mut method_id = [0; 4];33		method_id.copy_from_slice(&buf[0..4]);3435		Ok((u32::from_be_bytes(method_id), Self { buf, offset: 4 }))36	}3738	fn read_padleft<const S: usize>(&mut self) -> Result<[u8; S]> {39		if self.buf.len() - self.offset < 32 {40			return Err("missing padding");41		}42		let mut block = [0; S];43		// Verify padding is empty44		if !self.buf[self.offset..self.offset + ABI_ALIGNMENT - S]45			.iter()46			.all(|&v| v == 0)47		{48			return Err("non zero padding (wrong types?)");49		}50		block.copy_from_slice(51			&self.buf[self.offset + ABI_ALIGNMENT - S..self.offset + ABI_ALIGNMENT],52		);53		self.offset += ABI_ALIGNMENT;54		Ok(block)55	}5657	pub fn address(&mut self) -> Result<H160> {58		Ok(H160(self.read_padleft()?))59	}6061	pub fn bool(&mut self) -> Result<bool> {62		let data: [u8; 1] = self.read_padleft()?;63		match data[0] {64			0 => Ok(false),65			1 => Ok(true),66			_ => Err("wrong bool value"),67		}68	}6970	pub fn bytes4(&mut self) -> Result<[u8; 4]> {71		self.read_padleft()72	}7374	pub fn bytes(&mut self) -> Result<Vec<u8>> {75		let mut subresult = self.subresult()?;76		let length = subresult.read_usize()?;77		if subresult.buf.len() <= subresult.offset + length {78			return Err("bytes out of bounds");79		}80		Ok(subresult.buf[subresult.offset..subresult.offset + length].into())81	}8283	pub fn uint32(&mut self) -> Result<u32> {84		Ok(u32::from_be_bytes(self.read_padleft()?))85	}8687	pub fn uint128(&mut self) -> Result<u128> {88		Ok(u128::from_be_bytes(self.read_padleft()?))89	}9091	pub fn uint256(&mut self) -> Result<U256> {92		let buf: [u8; 32] = self.read_padleft()?;93		Ok(U256::from_big_endian(&buf))94	}9596	pub fn uint64(&mut self) -> Result<u64> {97		Ok(u64::from_be_bytes(self.read_padleft()?))98	}99100	pub fn read_usize(&mut self) -> Result<usize> {101		Ok(usize::from_be_bytes(self.read_padleft()?))102	}103104	fn subresult(&mut self) -> Result<AbiReader<'i>> {105		let offset = self.read_usize()?;106		Ok(AbiReader {107			buf: self.buf,108			offset: offset + self.offset,109		})110	}111112	pub fn is_finished(&self) -> bool {113		self.buf.len() == self.offset114	}115}116117#[derive(Default)]118pub struct AbiWriter {119	static_part: Vec<u8>,120	dynamic_part: Vec<(usize, AbiWriter)>,121}122impl AbiWriter {123	pub fn new() -> Self {124		Self::default()125	}126	pub fn new_call(method_id: u32) -> Self {127		let mut val = Self::new();128		val.static_part.extend(&method_id.to_be_bytes());129		val130	}131132	fn write_padleft(&mut self, block: &[u8]) {133		assert!(block.len() <= ABI_ALIGNMENT);134		self.static_part135			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - block.len()]);136		self.static_part.extend(block);137	}138139	fn write_padright(&mut self, bytes: &[u8]) {140		assert!(bytes.len() <= ABI_ALIGNMENT);141		self.static_part.extend(bytes);142		self.static_part143			.extend(&[0; ABI_ALIGNMENT][0..ABI_ALIGNMENT - bytes.len()]);144	}145146	pub fn address(&mut self, address: &H160) {147		self.write_padleft(&address.0)148	}149150	pub fn bool(&mut self, value: &bool) {151		self.write_padleft(&[if *value { 1 } else { 0 }])152	}153154	pub fn uint8(&mut self, value: &u8) {155		self.write_padleft(&[*value])156	}157158	pub fn uint32(&mut self, value: &u32) {159		self.write_padleft(&u32::to_be_bytes(*value))160	}161162	pub fn uint128(&mut self, value: &u128) {163		self.write_padleft(&u128::to_be_bytes(*value))164	}165166	/// This method writes u128, and exists only for convenience, because there is167	/// no u256 support in rust168	pub fn uint256(&mut self, value: &U256) {169		let mut out = [0; 32];170		value.to_big_endian(&mut out);171		self.write_padleft(&out)172	}173174	pub fn write_usize(&mut self, value: &usize) {175		self.write_padleft(&usize::to_be_bytes(*value))176	}177178	pub fn write_subresult(&mut self, result: Self) {179		self.dynamic_part.push((self.static_part.len(), result));180		// Empty block, to be filled later181		self.write_padleft(&[]);182	}183184	pub fn memory(&mut self, value: &[u8]) {185		let mut sub = Self::new();186		sub.write_usize(&value.len());187		for chunk in value.chunks(ABI_ALIGNMENT) {188			sub.write_padright(chunk);189		}190		self.write_subresult(sub);191	}192193	pub fn string(&mut self, value: &str) {194		self.memory(value.as_bytes())195	}196197	pub fn finish(mut self) -> Vec<u8> {198		for (static_offset, part) in self.dynamic_part {199			let part_offset = self.static_part.len();200201			let encoded_dynamic_offset = usize::to_be_bytes(part_offset - static_offset);202			self.static_part[static_offset + ABI_ALIGNMENT - encoded_dynamic_offset.len()203				..static_offset + ABI_ALIGNMENT]204				.copy_from_slice(&encoded_dynamic_offset);205			self.static_part.extend(part.finish())206		}207		self.static_part208	}209}210211pub trait AbiRead<T> {212	fn abi_read(&mut self) -> Result<T>;213}214215macro_rules! impl_abi_readable {216	($ty:ty, $method:ident) => {217		impl AbiRead<$ty> for AbiReader<'_> {218			fn abi_read(&mut self) -> Result<$ty> {219				self.$method()220			}221		}222	};223}224225impl_abi_readable!(u32, uint32);226impl_abi_readable!(u128, uint128);227impl_abi_readable!(U256, uint256);228impl_abi_readable!(H160, address);229impl_abi_readable!(Vec<u8>, bytes);230impl_abi_readable!(bool, bool);231232pub trait AbiWrite {233	fn abi_write(&self, writer: &mut AbiWriter);234}235236macro_rules! impl_abi_writeable {237	($ty:ty, $method:ident) => {238		impl AbiWrite for $ty {239			fn abi_write(&self, writer: &mut AbiWriter) {240				writer.$method(&self)241			}242		}243	};244}245246impl_abi_writeable!(u8, uint8);247impl_abi_writeable!(u32, uint32);248impl_abi_writeable!(u128, uint128);249impl_abi_writeable!(U256, uint256);250impl_abi_writeable!(H160, address);251impl_abi_writeable!(bool, bool);252impl_abi_writeable!(&str, string);253impl AbiWrite for &string {254	fn abi_write(&self, writer: &mut AbiWriter) {255		writer.string(self)256	}257}258259impl AbiWrite for () {260	fn abi_write(&self, _writer: &mut AbiWriter) {}261}262263/// Error, which can be constructed from any ToString type264/// Encoded to Abi as Error(string)265#[derive(Debug)]266pub struct StringError(String);267268impl<E> From<E> for StringError269where270	E: ToString,271{272	fn from(e: E) -> Self {273		Self(e.to_string())274	}275}276277impl From<StringError> for AbiWriter {278	fn from(v: StringError) -> Self {279		let mut out = AbiWriter::new_call(crate::fn_selector!(Error(string)));280		out.string(&v.0);281		out282	}283}284285#[macro_export]286macro_rules! abi_decode {287	($reader:expr, $($name:ident: $typ:ident),+ $(,)?) => {288		$(289			let $name = $reader.$typ()?;290		)+291	}292}293#[macro_export]294macro_rules! abi_encode {295	($($typ:ident($value:expr)),* $(,)?) => {{296		#[allow(unused_mut)]297		let mut writer = ::evm_coder::abi::AbiWriter::new();298		$(299			writer.$typ($value);300		)*301		writer302	}};303	(call $val:expr; $($typ:ident($value:expr)),* $(,)?) => {{304		#[allow(unused_mut)]305		let mut writer = ::evm_coder::abi::AbiWriter::new_call($val);306		$(307			writer.$typ($value);308		)*309		writer310	}}311}
modifiednode/cli/src/cli.rsdiffbeforeafterboth
--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -1,6 +1,4 @@
 use crate::chain_spec;
-use cumulus_client_cli;
-use sc_cli;
 use std::path::PathBuf;
 use structopt::StructOpt;
 
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -120,8 +120,7 @@
 	}
 
 	fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
-		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
-			.load_spec(id)
+		polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
 	}
 
 	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -129,6 +128,7 @@
 	}
 }
 
+#[allow(clippy::borrowed_box)]
 fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<Vec<u8>> {
 	let mut storage = chain_spec.build_storage()?;
 
@@ -189,7 +189,7 @@
 			runner.sync_run(|config| {
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
@@ -275,7 +275,7 @@
 
 				let polkadot_cli = RelayChainCli::new(
 					&config,
-					[RelayChainCli::executable_name().to_string()]
+					[RelayChainCli::executable_name()]
 						.iter()
 						.chain(cli.relaychain_args.iter()),
 				);
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -141,7 +141,7 @@
 
 	let (client, backend, keystore_container, task_manager) =
 		sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
-			&config,
+			config,
 			telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
 		)?;
 	let client = Arc::new(client);
modifiedpallets/contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/contract-helpers/src/lib.rs
+++ b/pallets/contract-helpers/src/lib.rs
@@ -213,7 +213,7 @@
 					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				Some(pallet_contracts::Call::instantiate_with_code(_, _, code, _, salt)) => {
-					let code_hash = &T::Hashing::hash(&code);
+					let code_hash = &T::Hashing::hash(code);
 					Ok(Some((who.clone(), *code_hash, salt.clone())))
 				}
 				_ => Ok(None),
modifiedpallets/nft/src/eth/erc_impl.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/erc_impl.rs
+++ b/pallets/nft/src/eth/erc_impl.rs
@@ -114,7 +114,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, token_id, 1)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, token_id, 1)
 			.map_err(|_| "transferFrom error")?;
 		Ok(())
 	}
@@ -130,7 +130,7 @@
 		let approved = T::CrossAccountId::from_eth(approved);
 		let token_id = token_id.try_into().map_err(|_| "token_id overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &approved, &self, token_id, 1)
+		<Module<T>>::approve_internal(&caller, &approved, self, token_id, 1)
 			.map_err(|_| "approve internal")?;
 		Ok(())
 	}
@@ -176,7 +176,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let token_id = token_id.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, token_id, 1)
+		<Module<T>>::transfer_internal(&caller, &to, self, token_id, 1)
 			.map_err(|_| "transfer error")?;
 		Ok(())
 	}
@@ -226,7 +226,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_internal(&caller, &to, &self, 1, amount)
+		<Module<T>>::transfer_internal(&caller, &to, self, 1, amount)
 			.map_err(|_| "transfer error")?;
 		Ok(true)
 	}
@@ -242,7 +242,7 @@
 		let to = T::CrossAccountId::from_eth(to);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::transfer_from_internal(&caller, &from, &to, &self, 1, amount)
+		<Module<T>>::transfer_from_internal(&caller, &from, &to, self, 1, amount)
 			.map_err(|_| "transferFrom error")?;
 		Ok(true)
 	}
@@ -251,7 +251,7 @@
 		let spender = T::CrossAccountId::from_eth(spender);
 		let amount = amount.try_into().map_err(|_| "amount overflow")?;
 
-		<Module<T>>::approve_internal(&caller, &spender, &self, 1, amount)
+		<Module<T>>::approve_internal(&caller, &spender, self, 1, amount)
 			.map_err(|_| "approve internal")?;
 		Ok(true)
 	}
modifiedpallets/nft/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/mod.rs
+++ b/pallets/nft/src/eth/mod.rs
@@ -108,7 +108,7 @@
 			.unwrap_or(false)
 	}
 	fn get_code(target: &H160) -> Option<Vec<u8>> {
-		map_eth_to_id(&target)
+		map_eth_to_id(target)
 			.and_then(<CollectionById<T>>::get)
 			.map(|collection| {
 				match collection.mode {
@@ -127,7 +127,7 @@
 		input: &[u8],
 		value: U256,
 	) -> Option<PrecompileOutput> {
-		let mut collection = map_eth_to_id(&target)
+		let mut collection = map_eth_to_id(target)
 			.and_then(|id| <CollectionHandle<T>>::get_with_gas_limit(id, gas_limit))?;
 		let (method_id, input) = AbiReader::new_call(input).unwrap();
 		let result = call_internal(&mut collection, *source, method_id, input, value);
modifiedpallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -132,10 +132,10 @@
 	) -> Result<Self::LiquidityInfo, pallet_evm::Error<T>> {
 		let mut who_pays_fee = *who;
 		if let WithdrawReason::Call { target, input } = &reason {
-			if let Some(collection_id) = crate::eth::map_eth_to_id(&target) {
+			if let Some(collection_id) = crate::eth::map_eth_to_id(target) {
 				if let Some(collection) = <CollectionById<T>>::get(collection_id) {
 					if let Some(sponsor) = collection.sponsorship.sponsor() {
-						if try_sponsor(who, collection_id, &collection, &input).is_ok() {
+						if try_sponsor(who, collection_id, &collection, input).is_ok() {
 							who_pays_fee =
 								T::EvmBackwardsAddressMapping::from_account_id(sponsor.clone());
 						}
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -1232,7 +1232,7 @@
 		) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let mut target_collection = Self::get_collection(collection_id)?;
-			Self::check_owner_permissions(&target_collection, &sender.as_sub())?;
+			Self::check_owner_permissions(&target_collection, sender.as_sub())?;
 			let old_limits = &target_collection.limits;
 			let chain_limits = ChainLimit::get();
 
@@ -1267,9 +1267,9 @@
 		owner: &T::CrossAccountId,
 		data: CreateItemData,
 	) -> DispatchResult {
-		Self::can_create_items_in_collection(&collection, &sender, &owner, 1)?;
-		Self::validate_create_item_args(&collection, &data)?;
-		Self::create_item_no_validation(&collection, owner, data)?;
+		Self::can_create_items_in_collection(collection, sender, owner, 1)?;
+		Self::validate_create_item_args(collection, &data)?;
+		Self::create_item_no_validation(collection, owner, data)?;
 
 		Ok(())
 	}
@@ -1283,18 +1283,18 @@
 	) -> DispatchResult {
 		target_collection.consume_gas(2000000)?;
 		// Limits check
-		Self::is_correct_transfer(target_collection, &recipient)?;
+		Self::is_correct_transfer(target_collection, recipient)?;
 
 		// Transfer permissions check
 		ensure!(
-			Self::is_item_owner(&sender, target_collection, item_id)
-				|| Self::is_owner_or_admin_permissions(target_collection, &sender),
+			Self::is_item_owner(sender, target_collection, item_id)
+				|| Self::is_owner_or_admin_permissions(target_collection, sender),
 			Error::<T>::NoPermission
 		);
 
 		if target_collection.access == AccessMode::WhiteList {
-			Self::check_white_list(target_collection, &sender)?;
-			Self::check_white_list(target_collection, &recipient)?;
+			Self::check_white_list(target_collection, sender)?;
+			Self::check_white_list(target_collection, recipient)?;
 		}
 
 		match target_collection.mode {
@@ -1305,7 +1305,7 @@
 				recipient.clone(),
 			)?,
 			CollectionMode::Fungible(_) => {
-				Self::transfer_fungible(target_collection, value, &sender, &recipient)?
+				Self::transfer_fungible(target_collection, value, sender, recipient)?
 			}
 			CollectionMode::ReFungible => Self::transfer_refungible(
 				target_collection,
@@ -1336,23 +1336,23 @@
 		amount: u128,
 	) -> DispatchResult {
 		collection.consume_gas(2000000)?;
-		Self::token_exists(&collection, item_id)?;
+		Self::token_exists(collection, item_id)?;
 
 		// Transfer permissions check
 		let bypasses_limits = collection.limits.owner_can_transfer
-			&& Self::is_owner_or_admin_permissions(&collection, &sender);
+			&& Self::is_owner_or_admin_permissions(collection, sender);
 
 		let allowance_limit = if bypasses_limits {
 			None
-		} else if let Some(amount) = Self::owned_amount(&sender, &collection, item_id) {
+		} else if let Some(amount) = Self::owned_amount(sender, collection, item_id) {
 			Some(amount)
 		} else {
 			fail!(Error::<T>::NoPermission);
 		};
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &spender)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, spender)?;
 		}
 
 		let allowance: u128 = amount
@@ -1412,19 +1412,19 @@
 			<Allowances<T>>::get(collection.id, (item_id, from.as_sub(), sender.as_sub()));
 
 		// Limits check
-		Self::is_correct_transfer(&collection, &recipient)?;
+		Self::is_correct_transfer(collection, recipient)?;
 
 		// Transfer permissions check
 		ensure!(
 			approval >= amount
 				|| (collection.limits.owner_can_transfer
-					&& Self::is_owner_or_admin_permissions(&collection, &sender)),
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
 			Error::<T>::NoPermission
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
-			Self::check_white_list(&collection, &recipient)?;
+			Self::check_white_list(collection, sender)?;
+			Self::check_white_list(collection, recipient)?;
 		}
 
 		// Reduce approval by transferred amount or remove if remaining approval drops to 0
@@ -1441,13 +1441,13 @@
 
 		match collection.mode {
 			CollectionMode::NFT => {
-				Self::transfer_nft(&collection, item_id, from.clone(), recipient.clone())?
+				Self::transfer_nft(collection, item_id, from.clone(), recipient.clone())?
 			}
 			CollectionMode::Fungible(_) => {
-				Self::transfer_fungible(&collection, amount, &from, &recipient)?
+				Self::transfer_fungible(collection, amount, from, recipient)?
 			}
 			CollectionMode::ReFungible => Self::transfer_refungible(
-				&collection,
+				collection,
 				item_id,
 				amount,
 				from.clone(),
@@ -1473,7 +1473,7 @@
 		item_id: TokenId,
 		data: Vec<u8>,
 	) -> DispatchResult {
-		Self::token_exists(&collection, item_id)?;
+		Self::token_exists(collection, item_id)?;
 
 		ensure!(
 			ChainLimit::get().custom_data_limit >= data.len() as u32,
@@ -1482,15 +1482,15 @@
 
 		// Modify permissions check
 		ensure!(
-			Self::is_item_owner(&sender, &collection, item_id)
-				|| Self::is_owner_or_admin_permissions(&collection, &sender),
+			Self::is_item_owner(sender, collection, item_id)
+				|| Self::is_owner_or_admin_permissions(collection, sender),
 			Error::<T>::NoPermission
 		);
 
 		match collection.mode {
-			CollectionMode::NFT => Self::set_nft_variable_data(&collection, item_id, data)?,
+			CollectionMode::NFT => Self::set_nft_variable_data(collection, item_id, data)?,
 			CollectionMode::ReFungible => {
-				Self::set_re_fungible_variable_data(&collection, item_id, data)?
+				Self::set_re_fungible_variable_data(collection, item_id, data)?
 			}
 			CollectionMode::Fungible(_) => fail!(Error::<T>::CantStoreMetadataInFungibleTokens),
 			_ => fail!(Error::<T>::UnexpectedCollectionType),
@@ -1505,18 +1505,13 @@
 		owner: &T::CrossAccountId,
 		items_data: Vec<CreateItemData>,
 	) -> DispatchResult {
-		Self::can_create_items_in_collection(
-			&collection,
-			&sender,
-			&owner,
-			items_data.len() as u32,
-		)?;
+		Self::can_create_items_in_collection(collection, sender, owner, items_data.len() as u32)?;
 
 		for data in &items_data {
-			Self::validate_create_item_args(&collection, data)?;
+			Self::validate_create_item_args(collection, data)?;
 		}
 		for data in &items_data {
-			Self::create_item_no_validation(&collection, owner, data.clone())?;
+			Self::create_item_no_validation(collection, owner, data.clone())?;
 		}
 
 		Ok(())
@@ -1529,22 +1524,20 @@
 		value: u128,
 	) -> DispatchResult {
 		ensure!(
-			Self::is_item_owner(&sender, &collection, item_id)
+			Self::is_item_owner(sender, collection, item_id)
 				|| (collection.limits.owner_can_transfer
-					&& Self::is_owner_or_admin_permissions(&collection, &sender)),
+					&& Self::is_owner_or_admin_permissions(collection, sender)),
 			Error::<T>::NoPermission
 		);
 
 		if collection.access == AccessMode::WhiteList {
-			Self::check_white_list(&collection, &sender)?;
+			Self::check_white_list(collection, sender)?;
 		}
 
 		match collection.mode {
-			CollectionMode::NFT => Self::burn_nft_item(&collection, item_id)?,
-			CollectionMode::Fungible(_) => Self::burn_fungible_item(&sender, &collection, value)?,
-			CollectionMode::ReFungible => {
-				Self::burn_refungible_item(&collection, item_id, &sender)?
-			}
+			CollectionMode::NFT => Self::burn_nft_item(collection, item_id)?,
+			CollectionMode::Fungible(_) => Self::burn_fungible_item(sender, collection, value)?,
+			CollectionMode::ReFungible => Self::burn_refungible_item(collection, item_id, sender)?,
 			_ => (),
 		};
 
@@ -1557,7 +1550,7 @@
 		address: &T::CrossAccountId,
 		whitelisted: bool,
 	) -> DispatchResult {
-		Self::check_owner_or_admin_permissions(&collection, &sender)?;
+		Self::check_owner_or_admin_permissions(collection, sender)?;
 
 		if whitelisted {
 			<WhiteList<T>>::insert(collection.id, address.as_sub(), true);
@@ -1610,7 +1603,7 @@
 			Error::<T>::AccountTokenLimitExceeded
 		);
 
-		if !Self::is_owner_or_admin_permissions(collection, &sender) {
+		if !Self::is_owner_or_admin_permissions(collection, sender) {
 			ensure!(collection.mint_mode, Error::<T>::PublicMintingNotAllowed);
 			Self::check_white_list(collection, owner)?;
 			Self::check_white_list(collection, sender)?;
@@ -1691,7 +1684,7 @@
 				Self::add_nft_item(collection, item)?;
 			}
 			CreateItemData::Fungible(data) => {
-				Self::add_fungible_item(collection, &owner, data.value)?;
+				Self::add_fungible_item(collection, owner, data.value)?;
 			}
 			CreateItemData::ReFungible(data) => {
 				let owner_list = vec![Ownership {
@@ -1934,7 +1927,7 @@
 		subject: &T::CrossAccountId,
 	) -> bool {
 		*subject.as_sub() == collection.owner
-			|| <AdminList<T>>::get(collection.id).contains(&subject)
+			|| <AdminList<T>>::get(collection.id).contains(subject)
 	}
 
 	fn check_owner_or_admin_permissions(
@@ -1979,7 +1972,7 @@
 	) -> bool {
 		match target_collection.mode {
 			CollectionMode::Fungible(_) => true,
-			_ => Self::owned_amount(&subject, target_collection, item_id).is_some(),
+			_ => Self::owned_amount(subject, target_collection, item_id).is_some(),
 		}
 	}
 
modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
--- a/pallets/nft/src/sponsorship.rs
+++ b/pallets/nft/src/sponsorship.rs
@@ -179,14 +179,14 @@
 {
 	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
 		match IsSubType::<Call<T>>::is_sub_type(call)? {
-			Call::create_item(collection_id, _owner, _properties) => {
-				Self::withdraw_create_item(who, collection_id, &_properties)
+			Call::create_item(collection_id, _owner, properties) => {
+				Self::withdraw_create_item(who, collection_id, properties)
 			}
 			Call::transfer(_new_owner, collection_id, item_id, _value) => {
 				Self::withdraw_transfer(who, collection_id, item_id)
 			}
 			Call::set_variable_meta_data(collection_id, item_id, data) => {
-				Self::withdraw_set_variable_meta_data(collection_id, item_id, &data)
+				Self::withdraw_set_variable_meta_data(collection_id, item_id, data)
 			}
 			_ => None,
 		}