···60606161 // Try to parse as ident, fall back to raw ident if needed
6262 syn::parse_str::<syn::Ident>(&sanitized).unwrap_or_else(|_| {
6363- eprintln!(
6464- "Warning: Invalid identifier '{}' sanitized to '{}'",
6565- s, sanitized
6666- );
6767- syn::Ident::new_raw(&sanitized, proc_macro2::Span::call_site())
6363+ // only print if the sanitization actually changed the name
6464+ // for types where the name is a keyword, will prepend 'r#'
6565+ if s != sanitized {
6666+ eprintln!(
6767+ "Warning: Invalid identifier '{}' sanitized to '{}'",
6868+ s, sanitized
6969+ );
7070+ syn::Ident::new(&sanitized, proc_macro2::Span::call_site())
7171+ } else {
7272+ syn::Ident::new_raw(&sanitized, proc_macro2::Span::call_site())
7373+ }
6874 })
6975}
7076