mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 09:11:02 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
use super::*;
|
||||
use frame_support::{ensure, traits::Get};
|
||||
use sp_runtime::{DispatchResult, DispatchError};
|
||||
use sp_runtime::{DispatchError, DispatchResult};
|
||||
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
pub(crate) fn do_transfer(
|
||||
@@ -52,9 +52,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
class: T::ClassId,
|
||||
instance: T::InstanceId,
|
||||
owner: T::AccountId,
|
||||
with_details: impl FnOnce(
|
||||
&ClassDetailsFor<T, I>,
|
||||
) -> DispatchResult,
|
||||
with_details: impl FnOnce(&ClassDetailsFor<T, I>) -> DispatchResult,
|
||||
) -> DispatchResult {
|
||||
ensure!(!Asset::<T, I>::contains_key(class, instance), Error::<T, I>::AlreadyExists);
|
||||
|
||||
@@ -63,8 +61,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
|
||||
with_details(&class_details)?;
|
||||
|
||||
let instances = class_details.instances.checked_add(1)
|
||||
.ok_or(ArithmeticError::Overflow)?;
|
||||
let instances =
|
||||
class_details.instances.checked_add(1).ok_or(ArithmeticError::Overflow)?;
|
||||
class_details.instances = instances;
|
||||
|
||||
let deposit = match class_details.free_holding {
|
||||
@@ -76,7 +74,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
|
||||
let owner = owner.clone();
|
||||
Account::<T, I>::insert((&owner, &class, &instance), ());
|
||||
let details = InstanceDetails { owner, approved: None, is_frozen: false, deposit};
|
||||
let details = InstanceDetails { owner, approved: None, is_frozen: false, deposit };
|
||||
Asset::<T, I>::insert(&class, &instance, details);
|
||||
Ok(())
|
||||
})?;
|
||||
@@ -88,23 +86,23 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
pub(super) fn do_burn(
|
||||
class: T::ClassId,
|
||||
instance: T::InstanceId,
|
||||
with_details: impl FnOnce(
|
||||
&ClassDetailsFor<T, I>,
|
||||
&InstanceDetailsFor<T, I>,
|
||||
) -> DispatchResult,
|
||||
with_details: impl FnOnce(&ClassDetailsFor<T, I>, &InstanceDetailsFor<T, I>) -> DispatchResult,
|
||||
) -> DispatchResult {
|
||||
let owner = Class::<T, I>::try_mutate(&class, |maybe_class_details| -> Result<T::AccountId, DispatchError> {
|
||||
let class_details = maybe_class_details.as_mut().ok_or(Error::<T, I>::Unknown)?;
|
||||
let details = Asset::<T, I>::get(&class, &instance)
|
||||
.ok_or(Error::<T, I>::Unknown)?;
|
||||
with_details(&class_details, &details)?;
|
||||
let owner = Class::<T, I>::try_mutate(
|
||||
&class,
|
||||
|maybe_class_details| -> Result<T::AccountId, DispatchError> {
|
||||
let class_details = maybe_class_details.as_mut().ok_or(Error::<T, I>::Unknown)?;
|
||||
let details =
|
||||
Asset::<T, I>::get(&class, &instance).ok_or(Error::<T, I>::Unknown)?;
|
||||
with_details(&class_details, &details)?;
|
||||
|
||||
// Return the deposit.
|
||||
T::Currency::unreserve(&class_details.owner, details.deposit);
|
||||
class_details.total_deposit.saturating_reduce(details.deposit);
|
||||
class_details.instances.saturating_dec();
|
||||
Ok(details.owner)
|
||||
})?;
|
||||
// Return the deposit.
|
||||
T::Currency::unreserve(&class_details.owner, details.deposit);
|
||||
class_details.total_deposit.saturating_reduce(details.deposit);
|
||||
class_details.instances.saturating_dec();
|
||||
Ok(details.owner)
|
||||
},
|
||||
)?;
|
||||
|
||||
Asset::<T, I>::remove(&class, &instance);
|
||||
Account::<T, I>::remove((&owner, &class, &instance));
|
||||
|
||||
Reference in New Issue
Block a user