diff --git a/crates/rs-macro/src/macro_inputs.rs b/crates/rs-macro/src/macro_inputs.rs index a1ac08e..c080cc6 100644 --- a/crates/rs-macro/src/macro_inputs.rs +++ b/crates/rs-macro/src/macro_inputs.rs @@ -169,20 +169,20 @@ pub(crate) struct TypeAlias { impl Parse for TypeAlias { fn parse(input: ParseStream) -> Result { - let abi = input - .parse::()? - .into_token_stream() - .to_string() - .replace(' ', ""); + let abi = sanitize_str(&input.parse::()?.into_token_stream().to_string()); input.parse::()?; - let alias = input.parse::()?.to_string(); + let alias = sanitize_str(&input.parse::()?.to_string()); Ok(TypeAlias { abi, alias }) } } +fn sanitize_str(abi: &str) -> String { + abi.trim().replace([' ', '\n', '\t'], "").to_string() +} + fn open_json_file(file_path: &str) -> Result { File::open(file_path).map_err(|e| { syn::Error::new(