From 35413b4657b2a11b94847a6ccbbcf130314dd912 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sun, 25 Jun 2023 13:46:31 +0200 Subject: [PATCH] Remove `Unwrappable` (#7415) * Remove * rm trait --- polkadot/xcm/src/v3/mod.rs | 4 ++-- polkadot/xcm/src/v3/traits.rs | 20 ------------------- .../xcm/xcm-executor/src/traits/export.rs | 2 +- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/polkadot/xcm/src/v3/mod.rs b/polkadot/xcm/src/v3/mod.rs index aac0b15d33..7e28c0cac6 100644 --- a/polkadot/xcm/src/v3/mod.rs +++ b/polkadot/xcm/src/v3/mod.rs @@ -49,7 +49,7 @@ pub use multilocation::{ }; pub use traits::{ send_xcm, validate_send, Error, ExecuteXcm, Outcome, PreparedMessage, Result, SendError, - SendResult, SendXcm, Unwrappable, Weight, XcmHash, + SendResult, SendXcm, Weight, XcmHash, }; // These parts of XCM v2 are unchanged in XCM v3, and are re-imported here. pub use super::v2::OriginKind; @@ -184,7 +184,7 @@ pub mod prelude { NetworkId::{self, *}, OriginKind, Outcome, PalletInfo, Parent, ParentThen, PreparedMessage, QueryId, QueryResponseInfo, Response, Result as XcmResult, SendError, SendResult, SendXcm, - Unwrappable, Weight, + Weight, WeightLimit::{self, *}, WildFungibility::{self, Fungible as WildFungible, NonFungible as WildNonFungible}, WildMultiAsset::{self, *}, diff --git a/polkadot/xcm/src/v3/traits.rs b/polkadot/xcm/src/v3/traits.rs index 0482c030ee..0f4c87ac6e 100644 --- a/polkadot/xcm/src/v3/traits.rs +++ b/polkadot/xcm/src/v3/traits.rs @@ -437,26 +437,6 @@ pub type XcmHash = [u8; 32]; /// Result value when attempting to send an XCM message. pub type SendResult = result::Result<(T, MultiAssets), SendError>; -pub trait Unwrappable { - type Inner; - fn none() -> Self; - fn some(i: Self::Inner) -> Self; - fn take(self) -> Option; -} - -impl Unwrappable for Option { - type Inner = T; - fn none() -> Self { - None - } - fn some(i: Self::Inner) -> Self { - Some(i) - } - fn take(self) -> Option { - self - } -} - /// Utility for sending an XCM message to a given location. /// /// These can be amalgamated in tuples to form sophisticated routing systems. In tuple format, each diff --git a/polkadot/xcm/xcm-executor/src/traits/export.rs b/polkadot/xcm/xcm-executor/src/traits/export.rs index 39667cec48..7aeccd4456 100644 --- a/polkadot/xcm/xcm-executor/src/traits/export.rs +++ b/polkadot/xcm/xcm-executor/src/traits/export.rs @@ -97,7 +97,7 @@ impl ExportXcm for Tuple { } } - fn deliver(one_ticket: Self::Ticket) -> Result { + fn deliver(mut one_ticket: Self::Ticket) -> Result { for_tuples!( #( if let Some(validated) = one_ticket.Tuple.take() { return Tuple::deliver(validated);