style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -238,10 +238,12 @@ impl AssetsInHolding {
|
||||
/// Returns `true` if `asset` is contained within `self`.
|
||||
pub fn contains_asset(&self, asset: &Asset) -> bool {
|
||||
match asset {
|
||||
Asset { fun: Fungible(amount), id } =>
|
||||
self.fungible.get(id).map_or(false, |a| a >= amount),
|
||||
Asset { fun: NonFungible(instance), id } =>
|
||||
self.non_fungible.contains(&(id.clone(), *instance)),
|
||||
Asset { fun: Fungible(amount), id } => {
|
||||
self.fungible.get(id).map_or(false, |a| a >= amount)
|
||||
},
|
||||
Asset { fun: NonFungible(instance), id } => {
|
||||
self.non_fungible.contains(&(id.clone(), *instance))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,8 +257,8 @@ impl AssetsInHolding {
|
||||
assets
|
||||
.fungible
|
||||
.iter()
|
||||
.all(|(k, v)| self.fungible.get(k).map_or(false, |a| a >= v)) &&
|
||||
self.non_fungible.is_superset(&assets.non_fungible)
|
||||
.all(|(k, v)| self.fungible.get(k).map_or(false, |a| a >= v))
|
||||
&& self.non_fungible.is_superset(&assets.non_fungible)
|
||||
}
|
||||
|
||||
/// Returns an error unless all `assets` are contained in `self`. In the case of an error, the
|
||||
@@ -303,8 +305,9 @@ impl AssetsInHolding {
|
||||
match mask {
|
||||
AssetFilter::Wild(All) | AssetFilter::Wild(AllCounted(_)) => match maybe_limit {
|
||||
None => return Ok(self.swapped(AssetsInHolding::new())),
|
||||
Some(limit) if self.len() <= limit =>
|
||||
return Ok(self.swapped(AssetsInHolding::new())),
|
||||
Some(limit) if self.len() <= limit => {
|
||||
return Ok(self.swapped(AssetsInHolding::new()))
|
||||
},
|
||||
Some(0) => return Ok(AssetsInHolding::new()),
|
||||
Some(limit) => {
|
||||
let fungible = mem::replace(&mut self.fungible, Default::default());
|
||||
@@ -325,15 +328,16 @@ impl AssetsInHolding {
|
||||
});
|
||||
},
|
||||
},
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildFungible, id, .. }) |
|
||||
AssetFilter::Wild(AllOf { fun: WildFungible, id }) =>
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildFungible, id, .. })
|
||||
| AssetFilter::Wild(AllOf { fun: WildFungible, id }) => {
|
||||
if maybe_limit.map_or(true, |l| l >= 1) {
|
||||
if let Some((id, amount)) = self.fungible.remove_entry(&id) {
|
||||
taken.fungible.insert(id, amount);
|
||||
}
|
||||
},
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildNonFungible, id, .. }) |
|
||||
AssetFilter::Wild(AllOf { fun: WildNonFungible, id }) => {
|
||||
}
|
||||
},
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildNonFungible, id, .. })
|
||||
| AssetFilter::Wild(AllOf { fun: WildNonFungible, id }) => {
|
||||
let non_fungible = mem::replace(&mut self.non_fungible, Default::default());
|
||||
non_fungible.into_iter().for_each(|(c, instance)| {
|
||||
if c == id && maybe_limit.map_or(true, |l| taken.len() < l) {
|
||||
@@ -417,12 +421,13 @@ impl AssetsInHolding {
|
||||
}
|
||||
Ok(self)
|
||||
},
|
||||
NonFungible(instance) =>
|
||||
NonFungible(instance) => {
|
||||
if self.non_fungible.remove(&(asset.id, instance)) {
|
||||
Ok(self)
|
||||
} else {
|
||||
Err(self)
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,14 +474,14 @@ impl AssetsInHolding {
|
||||
}
|
||||
}
|
||||
},
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildFungible, id, .. }) |
|
||||
AssetFilter::Wild(AllOf { fun: WildFungible, id }) => {
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildFungible, id, .. })
|
||||
| AssetFilter::Wild(AllOf { fun: WildFungible, id }) => {
|
||||
if let Some(&amount) = self.fungible.get(&id) {
|
||||
masked.fungible.insert(id.clone(), amount);
|
||||
}
|
||||
},
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildNonFungible, id, .. }) |
|
||||
AssetFilter::Wild(AllOf { fun: WildNonFungible, id }) => {
|
||||
AssetFilter::Wild(AllOfCounted { fun: WildNonFungible, id, .. })
|
||||
| AssetFilter::Wild(AllOf { fun: WildNonFungible, id }) => {
|
||||
for (c, instance) in self.non_fungible.iter() {
|
||||
if c == id {
|
||||
masked.non_fungible.insert((c.clone(), *instance));
|
||||
@@ -486,7 +491,7 @@ impl AssetsInHolding {
|
||||
}
|
||||
}
|
||||
},
|
||||
AssetFilter::Definite(assets) =>
|
||||
AssetFilter::Definite(assets) => {
|
||||
for asset in assets.inner().iter() {
|
||||
match asset {
|
||||
Asset { fun: Fungible(amount), id } => {
|
||||
@@ -501,7 +506,8 @@ impl AssetsInHolding {
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
masked
|
||||
}
|
||||
|
||||
@@ -540,8 +540,8 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
);
|
||||
if current_surplus.any_gt(Weight::zero()) {
|
||||
if let Some(w) = self.trader.refund_weight(current_surplus, &self.context) {
|
||||
if !self.holding.contains_asset(&(w.id.clone(), 1).into()) &&
|
||||
self.ensure_can_subsume_assets(1).is_err()
|
||||
if !self.holding.contains_asset(&(w.id.clone(), 1).into())
|
||||
&& self.ensure_can_subsume_assets(1).is_err()
|
||||
{
|
||||
let _ = self
|
||||
.trader
|
||||
@@ -890,10 +890,11 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
});
|
||||
}
|
||||
},
|
||||
Err(ref mut error) =>
|
||||
Err(ref mut error) => {
|
||||
if let Ok(x) = Config::Weigher::instr_weight(&mut instr) {
|
||||
error.weight.saturating_accrue(x)
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
result
|
||||
|
||||
@@ -40,9 +40,8 @@ impl From<LockError> for XcmError {
|
||||
match e {
|
||||
NotApplicable => XcmError::AssetNotFound,
|
||||
BadOrigin => XcmError::BadOrigin,
|
||||
WouldClobber | NotLocked | NotEnoughLocked | Unimplemented | NotTrusted |
|
||||
BadOwner | UnknownAsset | AssetNotOwned | NoResources | UnexpectedState | InUse =>
|
||||
XcmError::LockError,
|
||||
WouldClobber | NotLocked | NotEnoughLocked | Unimplemented | NotTrusted | BadOwner
|
||||
| UnknownAsset | AssetNotOwned | NoResources | UnexpectedState | InUse => XcmError::LockError,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ pub trait XcmAssetTransfers {
|
||||
|
||||
// try to determine reserve location based on asset id/location
|
||||
let asset_location = asset.id.0.chain_location();
|
||||
if asset_location == Location::here() ||
|
||||
Self::IsTeleporter::contains(asset, &asset_location)
|
||||
if asset_location == Location::here()
|
||||
|| Self::IsTeleporter::contains(asset, &asset_location)
|
||||
{
|
||||
// if the asset is local, then it's a local reserve
|
||||
// it's also a local reserve if the asset's location is not `here` but it's a location
|
||||
|
||||
@@ -68,8 +68,9 @@ impl From<Error> for XcmError {
|
||||
match e {
|
||||
Error::AssetNotHandled => XcmError::AssetNotFound,
|
||||
Error::AccountIdConversionFailed => FailedToTransactAsset("AccountIdConversionFailed"),
|
||||
Error::AmountToBalanceConversionFailed =>
|
||||
FailedToTransactAsset("AmountToBalanceConversionFailed"),
|
||||
Error::AmountToBalanceConversionFailed => {
|
||||
FailedToTransactAsset("AmountToBalanceConversionFailed")
|
||||
},
|
||||
Error::AssetIdConversionFailed => FailedToTransactAsset("AssetIdConversionFailed"),
|
||||
Error::InstanceConversionFailed => FailedToTransactAsset("InstanceConversionFailed"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user