From 507a3df6524e6ac06770b41fc3e0a77a44b60e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Wed, 31 Jul 2024 15:41:40 +0200 Subject: [PATCH] xso-proc: remove Span information from generated type names By removing that, the lint won't trigger for identifiers with trailing underscores (which become then embedded underscores which normally trips the `non_camel_case_types` lint). --- parsers/src/util/macro_tests.rs | 5 ++++- xso-proc/src/structs.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/parsers/src/util/macro_tests.rs b/parsers/src/util/macro_tests.rs index 82dd46fa..191be4c3 100644 --- a/parsers/src/util/macro_tests.rs +++ b/parsers/src/util/macro_tests.rs @@ -611,6 +611,9 @@ fn renamed_types_get_renamed() { assert!(std::mem::size_of::() >= 0); } +// What is this, you may wonder? +// This is a test that any generated type names won't trigger +// the `non_camel_case_types` lint. #[derive(FromXml, AsXml, PartialEq, Debug, Clone)] #[xml(namespace = NS1, name = "elem")] -struct Foo_; +struct LintTest_; diff --git a/xso-proc/src/structs.rs b/xso-proc/src/structs.rs index ffc1e83e..82b5063d 100644 --- a/xso-proc/src/structs.rs +++ b/xso-proc/src/structs.rs @@ -77,12 +77,12 @@ impl StructDef { let builder_ty_ident = match meta.builder { Some(v) => v, - None => quote::format_ident!("{}FromXmlBuilder", ident), + None => quote::format_ident!("{}FromXmlBuilder", ident.to_string()), }; let item_iter_ty_ident = match meta.iterator { Some(v) => v, - None => quote::format_ident!("{}AsXmlIterator", ident), + None => quote::format_ident!("{}AsXmlIterator", ident.to_string()), }; Ok(Self {