xso-proc: remove stripping of trailing _ from type names

Users can now rename the generated types altogether, which means that we
do not need this anymore to avoid lints.
This commit is contained in:
Jonas Schäfer 2024-07-31 15:40:41 +02:00 committed by Link Mauve
commit 3089832090
4 changed files with 7 additions and 21 deletions

View file

@ -64,16 +64,6 @@ pub(crate) struct StructDef {
debug: bool,
}
fn concat_camel_case(lhs: &Ident, suffix: &str) -> Ident {
let span = lhs.span();
let mut s = lhs.to_string();
while s.ends_with('_') {
s.pop();
}
s.push_str(suffix);
Ident::new(&s, span)
}
impl StructDef {
/// Create a new struct from its name, meta, and fields.
pub(crate) fn new(ident: &Ident, meta: XmlCompoundMeta, fields: &Fields) -> Result<Self> {
@ -87,12 +77,12 @@ impl StructDef {
let builder_ty_ident = match meta.builder {
Some(v) => v,
None => concat_camel_case(ident, "FromXmlBuilder"),
None => quote::format_ident!("{}FromXmlBuilder", ident),
};
let item_iter_ty_ident = match meta.iterator {
Some(v) => v,
None => concat_camel_case(ident, "AsXmlIterator"),
None => quote::format_ident!("{}AsXmlIterator", ident),
};
Ok(Self {