mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Allow spaces in types for decl_storage proc_macro (#1245)
* Do not try to fix type display for metadata in rust. * Fix test (adding extra space (we can see it as a canary: if at some point quote got a better output the test will fail and js space removal could be remove)).
This commit is contained in:
@@ -49,7 +49,6 @@ macro_rules! try_tok(( $expre : expr ) => {
|
||||
pub fn decl_storage_impl(input: TokenStream) -> TokenStream {
|
||||
let def = parse_macro_input!(input as StorageDefinition);
|
||||
|
||||
// old macro naming convention (s replaces $)
|
||||
let StorageDefinition {
|
||||
hidden_crate,
|
||||
visibility,
|
||||
@@ -578,7 +577,7 @@ fn store_functions_to_metadata (
|
||||
let is_option = extracted_opt.is_some();
|
||||
let typ = extracted_opt.unwrap_or(quote!( #gettype ));
|
||||
let stype = if is_simple {
|
||||
let styp = typ.to_string().replace(" ","");
|
||||
let styp = typ.to_string();
|
||||
quote!{
|
||||
#scrate::storage::generator::StorageFunctionType::Plain(
|
||||
#scrate::storage::generator::DecodeDifferent::Encode(#styp),
|
||||
@@ -587,7 +586,7 @@ fn store_functions_to_metadata (
|
||||
} else {
|
||||
let kty = stk.expect("is not simple; qed");
|
||||
let kty = quote!(#kty).to_string();
|
||||
let styp = typ.to_string().replace(" ","");
|
||||
let styp = typ.to_string();
|
||||
quote!{
|
||||
#scrate::storage::generator::StorageFunctionType::Map {
|
||||
key: #scrate::storage::generator::DecodeDifferent::Encode(#kty),
|
||||
|
||||
@@ -677,7 +677,7 @@ mod tests {
|
||||
StorageFunctionMetadata {
|
||||
name: DecodeDifferent::Encode("GETU32"),
|
||||
modifier: StorageFunctionModifier::Default,
|
||||
ty: StorageFunctionType::Plain(DecodeDifferent::Encode("T::Origin")),
|
||||
ty: StorageFunctionType::Plain(DecodeDifferent::Encode("T :: Origin")),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageFunctionMetadata {
|
||||
|
||||
Reference in New Issue
Block a user