A better Rust ATProto crate

adjusted ident parsing to be a bit less noisy when adjusting stuff that's a rust keyword, versus actually changing the name

+11 -5
+11 -5
crates/jacquard-lexicon/src/codegen/utils.rs
··· 60 60 61 61 // Try to parse as ident, fall back to raw ident if needed 62 62 syn::parse_str::<syn::Ident>(&sanitized).unwrap_or_else(|_| { 63 - eprintln!( 64 - "Warning: Invalid identifier '{}' sanitized to '{}'", 65 - s, sanitized 66 - ); 67 - syn::Ident::new_raw(&sanitized, proc_macro2::Span::call_site()) 63 + // only print if the sanitization actually changed the name 64 + // for types where the name is a keyword, will prepend 'r#' 65 + if s != sanitized { 66 + eprintln!( 67 + "Warning: Invalid identifier '{}' sanitized to '{}'", 68 + s, sanitized 69 + ); 70 + syn::Ident::new(&sanitized, proc_macro2::Span::call_site()) 71 + } else { 72 + syn::Ident::new_raw(&sanitized, proc_macro2::Span::call_site()) 73 + } 68 74 }) 69 75 } 70 76