From 21bbdc4855b51614272af79ce817b21430e868e7 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 2 May 2024 12:09:09 +0000 Subject: [PATCH] codegen: Use quote::idents instead of &str for naming types Signed-off-by: Alexandru Vasile --- codegen/src/api/custom_values.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codegen/src/api/custom_values.rs b/codegen/src/api/custom_values.rs index e567900ab0..0b0815fab5 100644 --- a/codegen/src/api/custom_values.rs +++ b/codegen/src/api/custom_values.rs @@ -9,7 +9,7 @@ use std::collections::HashSet; use subxt_metadata::{CustomValueMetadata, Metadata}; use proc_macro2::TokenStream as TokenStream2; -use quote::quote; +use quote::{format_ident, quote}; /// Generate the custom values mod, if there are any custom values in the metadata. Else returns None. pub fn generate_custom_values( @@ -20,7 +20,8 @@ pub fn generate_custom_values( let mut fn_names_taken = HashSet::new(); let custom = metadata.custom(); let custom_types = custom.iter().map(|custom| { - let name = custom.name(); + let name = format_ident!("{}", custom.name()); + let Ok(ty) = type_gen.resolve_type_path(custom.type_id()) else { return quote! {}; };