git.delta.rocks / unique-network / refs/commits / 9c3e59a24962

difftreelog

fix clippy

Daniel Shiposha2023-10-24parent: #cafc907.patch.diff
in: master

5 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -2387,7 +2387,7 @@
 		amount: u128,
 		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
-		if T::CrossTokenAddressMapping::is_token_address(&to) {
+		if T::CrossTokenAddressMapping::is_token_address(to) {
 			return unsupported!(T);
 		}
 
modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth
--- a/pallets/foreign-assets/src/lib.rs
+++ b/pallets/foreign-assets/src/lib.rs
@@ -240,9 +240,7 @@
 	) -> Result<Option<CollectionId>, XcmError> {
 		let self_location = T::SelfLocation::get();
 
-		if *asset_location == Here.into() {
-			Ok(Some(NATIVE_FUNGIBLE_COLLECTION_ID))
-		} else if *asset_location == self_location {
+		if *asset_location == Here.into() || *asset_location == self_location {
 			Ok(Some(NATIVE_FUNGIBLE_COLLECTION_ID))
 		} else if asset_location.parents == self_location.parents {
 			match asset_location
@@ -395,7 +393,7 @@
 		asset_instance: &AssetInstance,
 		from: T::CrossAccountId,
 	) -> XcmResult {
-		let token_id = Self::asset_instance_to_token_id(collection_id, &asset_instance)?
+		let token_id = Self::asset_instance_to_token_id(collection_id, asset_instance)?
 			.ok_or(XcmError::AssetNotFound)?;
 
 		if xcm_ext.token_has_children(token_id) {
@@ -569,11 +567,11 @@
 	Fungible(u8),
 }
 
-impl Into<CollectionMode> for ForeignCollectionMode {
-	fn into(self) -> CollectionMode {
-		match self {
-			Self::NFT => CollectionMode::NFT,
-			Self::Fungible(decimals) => CollectionMode::Fungible(decimals),
+impl From<ForeignCollectionMode> for CollectionMode {
+	fn from(value: ForeignCollectionMode) -> Self {
+		match value {
+			ForeignCollectionMode::NFT => Self::NFT,
+			ForeignCollectionMode::Fungible(decimals) => Self::Fungible(decimals),
 		}
 	}
 }
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -470,7 +470,7 @@
 			up_data_structs::CreateItemData::Fungible(fungible_data) => {
 				<Pallet<T>>::create_multiple_items(
 					self,
-					&depositor,
+					depositor,
 					[(to, fungible_data.value)].into_iter().collect(),
 					nesting_budget,
 				)?
@@ -495,7 +495,7 @@
 			<CommonError<T>>::FungibleItemsHaveNoId
 		);
 
-		<Pallet<T>>::transfer_internal(self, &depositor, &from, &to, amount, nesting_budget)
+		<Pallet<T>>::transfer_internal(self, depositor, from, to, amount, nesting_budget)
 			.map(|_| ())
 			.map_err(|post_info| post_info.error)
 	}
@@ -506,7 +506,7 @@
 		token: TokenId,
 		amount: u128,
 	) -> sp_runtime::DispatchResult {
-		<Self as CommonCollectionOperations<T>>::burn_item(&self, from, token, amount)
+		<Self as CommonCollectionOperations<T>>::burn_item(self, from, token, amount)
 			.map(|_| ())
 			.map_err(|post_info| post_info.error)
 	}
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -585,7 +585,7 @@
 	) -> Result<TokenId, sp_runtime::DispatchError> {
 		<Pallet<T>>::create_multiple_items(
 			self,
-			&depositor,
+			depositor,
 			vec![map_create_data::<T>(data, &to)?],
 			nesting_budget,
 		)?;
@@ -604,7 +604,7 @@
 	) -> sp_runtime::DispatchResult {
 		ensure!(amount == 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
 
-		<Pallet<T>>::transfer_internal(self, &depositor, &from, &to, token, nesting_budget)
+		<Pallet<T>>::transfer_internal(self, depositor, from, to, token, nesting_budget)
 			.map(|_| ())
 			.map_err(|post_info| post_info.error)
 	}
modifiedruntime/common/config/pallets/foreign_asset.rsdiffbeforeafterboth
before · runtime/common/config/pallets/foreign_asset.rs
1use frame_support::{parameter_types, PalletId};2#[cfg(not(feature = "governance"))]3use frame_system::EnsureRoot;4use pallet_evm::account::CrossAccountId;5use sp_core::H160;6use staging_xcm::prelude::*;7use staging_xcm_builder::AccountKey20Aliases;89#[cfg(feature = "governance")]10use crate::runtime_common::config::governance;11use crate::{12	runtime_common::config::{13		ethereum::CrossAccountId as ConfigCrossAccountId,14		xcm::{LocationToAccountId, SelfLocation},15	},16	RelayNetwork, Runtime, RuntimeEvent,17};1819parameter_types! {20	pub ForeignAssetPalletId: PalletId = PalletId(*b"frgnasts");21}2223pub struct LocationToCrossAccountId;24impl staging_xcm_executor::traits::ConvertLocation<ConfigCrossAccountId>25	for LocationToCrossAccountId26{27	fn convert_location(location: &MultiLocation) -> Option<ConfigCrossAccountId> {28		LocationToAccountId::convert_location(location)29			.map(|sub| ConfigCrossAccountId::from_sub(sub))30			.or_else(|| {31				let eth_address =32					AccountKey20Aliases::<RelayNetwork, H160>::convert_location(location)?;3334				Some(ConfigCrossAccountId::from_eth(eth_address))35			})36	}37}3839impl pallet_foreign_assets::Config for Runtime {40	type RuntimeEvent = RuntimeEvent;4142	#[cfg(feature = "governance")]43	type ForceRegisterOrigin = governance::RootOrTechnicalCommitteeMember;4445	#[cfg(not(feature = "governance"))]46	type ForceRegisterOrigin = EnsureRoot<Self::AccountId>;4748	type PalletId = ForeignAssetPalletId;49	type SelfLocation = SelfLocation;50	type LocationToAccountId = LocationToCrossAccountId;51	type WeightInfo = pallet_foreign_assets::weights::SubstrateWeight<Self>;52}