--- a/pallets/proxy-rmrk-core/src/lib.rs +++ b/pallets/proxy-rmrk-core/src/lib.rs @@ -1362,12 +1362,13 @@ pub fn get_collection_type( collection_id: CollectionId, ) -> Result { - Self::get_collection_property_decoded(collection_id, CollectionType) - .map_err(|err| if err != >::CollectionUnknown.into() { + Self::get_collection_property_decoded(collection_id, CollectionType).map_err(|err| { + if err != >::CollectionUnknown.into() { >::CorruptedCollectionType.into() } else { err - }) + } + }) } pub fn ensure_collection_type( --- a/pallets/proxy-rmrk-equip/src/lib.rs +++ b/pallets/proxy-rmrk-equip/src/lib.rs @@ -22,8 +22,7 @@ use up_data_structs::*; use pallet_common::{Pallet as PalletCommon, Error as CommonError}; use pallet_rmrk_core::{ - Pallet as PalletCore, - Error as CoreError, + Pallet as PalletCore, Error as CoreError, misc::{self, *}, property::RmrkProperty::*, }; @@ -228,12 +227,17 @@ let base_collection_id = base_id.into(); let collection = Self::get_base(base_collection_id)?; - >::check_collection_owner(&collection, &T::CrossAccountId::from_sub(sender)) - .map_err(|err| if err == >::NoPermission.into() { + >::check_collection_owner( + &collection, + &T::CrossAccountId::from_sub(sender), + ) + .map_err(|err| { + if err == >::NoPermission.into() { >::PermissionError.into() } else { err - })?; + } + })?; let part_id = Self::internal_part_id(base_collection_id, slot_id) .ok_or(>::PartDoesntExist)?; @@ -254,10 +258,7 @@ } } - Self::deposit_event(Event::EquippablesUpdated { - base_id, - slot_id, - }); + Self::deposit_event(Event::EquippablesUpdated { base_id, slot_id }); Ok(()) } @@ -284,16 +285,12 @@ let token_id = match Self::internal_part_id(collection.id, part_id) { Some(token_id) => token_id, None => { - let token_id = >::create_nft( - sender, - owner, - collection, - [].into_iter(), - ) - .map_err(|err| match err { - DispatchError::Arithmetic(_) => >::NoAvailablePartId.into(), - err => err, - })?; + let token_id = + >::create_nft(sender, owner, collection, [].into_iter()) + .map_err(|err| match err { + DispatchError::Arithmetic(_) => >::NoAvailablePartId.into(), + err => err, + })?; >::insert(collection.id, part_id, token_id); @@ -317,7 +314,7 @@ >::rmrk_property(Src, &src)?, >::rmrk_property(ZIndex, &z_index)?, ] - .into_iter() + .into_iter(), )?; if let RmrkPartType::SlotPart(part) = part { @@ -325,7 +322,7 @@ collection.id, token_id, PropertyScope::Rmrk, - >::rmrk_property(EquippableList, &part.equippable)? + >::rmrk_property(EquippableList, &part.equippable)?, )?; } @@ -333,12 +330,15 @@ } fn get_base(base_id: CollectionId) -> Result, DispatchError> { - let collection = >::get_typed_nft_collection(base_id, misc::CollectionType::Base) - .map_err(|err| if err == >::CollectionUnknown.into() { - >::BaseDoesntExist.into() - } else { - err - })?; + let collection = + >::get_typed_nft_collection(base_id, misc::CollectionType::Base) + .map_err(|err| { + if err == >::CollectionUnknown.into() { + >::BaseDoesntExist.into() + } else { + err + } + })?; collection.check_is_external()?; Ok(collection) --- a/primitives/data-structs/src/lib.rs +++ b/primitives/data-structs/src/lib.rs @@ -987,7 +987,8 @@ pub type RmrkResourceInfo = ResourceInfo; pub type RmrkPropertyInfo = PropertyInfo; pub type RmrkBaseInfo = BaseInfo; -pub type BoundedEquippableCollectionIds = BoundedVec; +pub type BoundedEquippableCollectionIds = + BoundedVec; pub type RmrkPartType = PartType; pub type RmrkEquippableList = EquippableList; pub type RmrkThemeProperty = ThemeProperty;