This repository was archived by the owner on Nov 15, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed
Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ fn generate_conversion_from_v1() -> TokenStream {
9696 . collect :: < TokenStream > ( ) ;
9797
9898 quote ! {
99- impl TryFrom <crate :: v1:: MultiLocation > for MultiLocation {
99+ impl core :: convert :: TryFrom <crate :: v1:: MultiLocation > for MultiLocation {
100100 type Error = ( ) ;
101101 fn try_from( v1: crate :: v1:: MultiLocation ) -> core:: result:: Result <Self , ( ) > {
102102 let mut res = MultiLocation :: Null ;
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ fn generate_conversion_from_v0() -> TokenStream {
172172 if #( #parent_idents. is_parent( ) ) &&* =>
173173 Ok ( MultiLocation {
174174 parents: #parent_count,
175- interior: #junction_variant( #( #junction_idents . try_into( ) ? ) , * ) ,
175+ interior: #junction_variant( #( core :: convert :: TryInto :: try_into( #junction_idents ) ? ) , * ) ,
176176 } ) ,
177177 }
178178 } )
@@ -184,16 +184,18 @@ fn generate_conversion_from_v0() -> TokenStream {
184184 Ok ( MultiLocation :: ancestor( #num_ancestors) ) ,
185185 #intermediate_match_arms
186186 crate :: v0:: MultiLocation :: #variant( #( #idents) , * ) =>
187- Ok ( #variant( #( #idents . try_into( ) ? ) , * ) . into( ) ) ,
187+ Ok ( #variant( #( core :: convert :: TryInto :: try_into( #idents ) ? ) , * ) . into( ) ) ,
188188 }
189189 } )
190190 . collect :: < TokenStream > ( ) ;
191191
192192 quote ! {
193- impl TryFrom <crate :: v0:: MultiLocation > for MultiLocation {
193+ impl core :: convert :: TryFrom <crate :: v0:: MultiLocation > for MultiLocation {
194194 type Error = ( ) ;
195- fn try_from( v0: crate :: v0:: MultiLocation ) -> core:: result:: Result <Self , ( ) > {
195+ fn try_from( mut v0: crate :: v0:: MultiLocation ) -> core:: result:: Result <Self , ( ) > {
196196 use Junctions :: * ;
197+
198+ v0. canonicalize( ) ;
197199 match v0 {
198200 crate :: v0:: MultiLocation :: Null => Ok ( Here . into( ) ) ,
199201 #match_variants
Original file line number Diff line number Diff line change 1717//! Cross-Consensus Message format data structures.
1818
1919use super :: Junction ;
20- use core:: { convert :: TryFrom , mem, result} ;
20+ use core:: { mem, result} ;
2121use parity_scale_codec:: { self , Decode , Encode } ;
2222
2323/// A relative path between state-bearing consensus systems.
Original file line number Diff line number Diff line change 1717//! Cross-Consensus Message format data structures.
1818
1919use super :: Junction ;
20- use core:: {
21- convert:: { TryFrom , TryInto } ,
22- mem, result,
23- } ;
20+ use core:: { convert:: TryFrom , mem, result} ;
2421use parity_scale_codec:: { Decode , Encode } ;
2522
2623/// A relative path between state-bearing consensus systems.
@@ -898,7 +895,7 @@ mod tests {
898895 ) ;
899896 assert_eq ! (
900897 v0:: MultiLocation :: X2 ( v0:: Junction :: Parachain ( 88 ) , v0:: Junction :: Parent ) . try_into( ) ,
901- Err :: < MultiLocation , ( ) > ( ( ) ) ,
898+ Ok ( MultiLocation :: here ( ) ) ,
902899 ) ;
903900 assert_eq ! (
904901 v0:: MultiLocation :: X3 (
You can’t perform that action at this time.
0 commit comments