Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mrshiposha committed Oct 24, 2023
1 parent b2db3c1 commit 2b4135f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pallets/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ where
amount: u128,
nesting_budget: &dyn Budget,
) -> DispatchResult {
if T::CrossTokenAddressMapping::is_token_address(&to) {
if T::CrossTokenAddressMapping::is_token_address(to) {
return unsupported!(T);
}

Expand Down
16 changes: 7 additions & 9 deletions pallets/foreign-assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ impl<T: Config> Pallet<T> {
) -> 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
Expand Down Expand Up @@ -395,7 +393,7 @@ impl<T: Config> Pallet<T> {
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) {
Expand Down Expand Up @@ -569,11 +567,11 @@ pub enum ForeignCollectionMode {
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),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions pallets/fungible/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<T: Config> XcmExtensions<T> for FungibleHandle<T> {
up_data_structs::CreateItemData::Fungible(fungible_data) => {
<Pallet<T>>::create_multiple_items(
self,
&depositor,
depositor,
[(to, fungible_data.value)].into_iter().collect(),
nesting_budget,
)?
Expand All @@ -495,7 +495,7 @@ impl<T: Config> XcmExtensions<T> for FungibleHandle<T> {
<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)
}
Expand All @@ -506,7 +506,7 @@ impl<T: Config> XcmExtensions<T> for FungibleHandle<T> {
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)
}
Expand Down
4 changes: 2 additions & 2 deletions pallets/nonfungible/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ impl<T: Config> XcmExtensions<T> for NonfungibleHandle<T> {
) -> Result<TokenId, sp_runtime::DispatchError> {
<Pallet<T>>::create_multiple_items(
self,
&depositor,
depositor,
vec![map_create_data::<T>(data, &to)?],
nesting_budget,
)?;
Expand All @@ -604,7 +604,7 @@ impl<T: Config> XcmExtensions<T> for NonfungibleHandle<T> {
) -> 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)
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/config/pallets/foreign_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl staging_xcm_executor::traits::ConvertLocation<ConfigCrossAccountId>
{
fn convert_location(location: &MultiLocation) -> Option<ConfigCrossAccountId> {
LocationToAccountId::convert_location(location)
.map(|sub| ConfigCrossAccountId::from_sub(sub))
.map(ConfigCrossAccountId::from_sub)
.or_else(|| {
let eth_address =
AccountKey20Aliases::<RelayNetwork, H160>::convert_location(location)?;
Expand Down

0 comments on commit 2b4135f

Please sign in to comment.