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:
Bastian Köcher
2021-07-21 16:32:32 +02:00
committed by GitHub
parent d451c38c1c
commit 7b56ab15b4
1010 changed files with 53339 additions and 51208 deletions
+16 -15
View File
@@ -38,9 +38,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Get the total supply of an asset `id`.
pub fn total_supply(id: T::AssetId) -> T::Balance {
Asset::<T, I>::get(id)
.map(|x| x.supply)
.unwrap_or_else(Zero::zero)
Asset::<T, I>::get(id).map(|x| x.supply).unwrap_or_else(Zero::zero)
}
pub(super) fn new_account(
@@ -134,7 +132,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
match frozen.checked_add(&details.min_balance) {
Some(required) if rest < required => return Frozen,
None => return Overflow,
_ => {}
_ => {},
}
}
@@ -171,9 +169,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
let amount = if let Some(frozen) = T::Freezer::frozen_balance(id, who) {
// Frozen balance: account CANNOT be deleted
let required = frozen
.checked_add(&details.min_balance)
.ok_or(ArithmeticError::Overflow)?;
let required =
frozen.checked_add(&details.min_balance).ok_or(ArithmeticError::Overflow)?;
account.balance.saturating_sub(required)
} else {
let is_provider = false;
@@ -219,7 +216,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Err(e) => {
debug_assert!(false, "passed from reducible_balance; qed");
return Err(e.into())
}
},
};
Ok(actual)
@@ -268,12 +265,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
) -> DispatchResult {
Self::increase_balance(id, beneficiary, amount, |details| -> DispatchResult {
if let Some(check_issuer) = maybe_check_issuer {
ensure!(
&check_issuer == &details.issuer,
Error::<T, I>::NoPermission
);
ensure!(&check_issuer == &details.issuer, Error::<T, I>::NoPermission);
}
debug_assert!(T::Balance::max_value() - details.supply >= amount, "checked in prep; qed");
debug_assert!(
T::Balance::max_value() - details.supply >= amount,
"checked in prep; qed"
);
details.supply = details.supply.saturating_add(amount);
Ok(())
})?;
@@ -295,7 +292,9 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
&mut AssetDetails<T::Balance, T::AccountId, DepositBalanceOf<T, I>>,
) -> DispatchResult,
) -> DispatchResult {
if amount.is_zero() { return Ok(()) }
if amount.is_zero() {
return Ok(())
}
Self::can_increase(id, beneficiary, amount).into_result()?;
Asset::<T, I>::try_mutate(id, |maybe_details| -> DispatchResult {
@@ -364,7 +363,9 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
&mut AssetDetails<T::Balance, T::AccountId, DepositBalanceOf<T, I>>,
) -> DispatchResult,
) -> Result<T::Balance, DispatchError> {
if amount.is_zero() { return Ok(amount) }
if amount.is_zero() {
return Ok(amount)
}
let actual = Self::prep_debit(id, target, amount, f)?;