mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Fix Clippy (#2522)
* Import Clippy config from Polkadot Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Auto clippy fix Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * No tabs in comments Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Prefer matches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Dont drop references Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Trivial Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Refactor Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * add clippy to ci * Clippy reborrow Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Partially revert 'Prefer matches' Using matches! instead of match does give less compiler checks as per review from @chevdor. Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update .cargo/config.toml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Revert revert 💩 Should be fine to use matches! macro since it is an explicit whitelist, not wildcard matching. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: alvicsam <alvicsam@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Chevdor <chevdor@users.noreply.github.com> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
b72ae577a0
commit
299d25ba4b
@@ -43,7 +43,7 @@ where
|
||||
asset_location: &MultiLocation,
|
||||
) -> sp_std::result::Result<Self::Success, RuntimeOrigin> {
|
||||
let origin_location = EnsureXcm::<Everything>::try_origin(origin.clone())?;
|
||||
if !IsForeign::contains(&asset_location, &origin_location) {
|
||||
if !IsForeign::contains(asset_location, &origin_location) {
|
||||
return Err(origin)
|
||||
}
|
||||
AccountOf::convert(origin_location).map_err(|_| origin)
|
||||
@@ -51,6 +51,6 @@ where
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin(a: &MultiLocation) -> Result<RuntimeOrigin, ()> {
|
||||
Ok(pallet_xcm::Origin::Xcm(a.clone()).into())
|
||||
Ok(pallet_xcm::Origin::Xcm(*a).into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,7 @@ impl<Network: Get<NetworkId>> Contains<MultiLocation>
|
||||
for StartsWithExplicitGlobalConsensus<Network>
|
||||
{
|
||||
fn contains(t: &MultiLocation) -> bool {
|
||||
match t.interior.global_consensus() {
|
||||
Ok(requested_network) if requested_network.eq(&Network::get()) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(t.interior.global_consensus(), Ok(requested_network) if requested_network.eq(&Network::get()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +58,7 @@ impl<IsForeign: ContainsPair<MultiLocation, MultiLocation>> ContainsPair<MultiAs
|
||||
{
|
||||
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
|
||||
log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin);
|
||||
matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, &origin))
|
||||
matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, origin))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,18 +70,14 @@ impl<SelfParaId: Get<ParaId>> ContainsPair<MultiLocation, MultiLocation>
|
||||
{
|
||||
fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool {
|
||||
// `a` needs to be from `b` at least
|
||||
if !a.starts_with(&b) {
|
||||
if !a.starts_with(b) {
|
||||
return false
|
||||
}
|
||||
|
||||
// here we check if sibling
|
||||
match a {
|
||||
MultiLocation { parents: 1, interior } => match interior.first() {
|
||||
Some(Parachain(sibling_para_id))
|
||||
if sibling_para_id.ne(&u32::from(SelfParaId::get())) =>
|
||||
true,
|
||||
_ => false,
|
||||
},
|
||||
MultiLocation { parents: 1, interior } =>
|
||||
matches!(interior.first(), Some(Parachain(sibling_para_id)) if sibling_para_id.ne(&u32::from(SelfParaId::get()))),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user