xml: small changes

This commit is contained in:
Lennart
2024-12-22 12:53:32 +01:00
parent 043ce8bcd0
commit cd4137cda1
4 changed files with 10 additions and 19 deletions

View File

@@ -7,18 +7,9 @@ use syn::{DataStruct, DeriveInput};
fn invalid_field_branch(allow: bool) -> proc_macro2::TokenStream {
if allow {
quote! {
_ => {
// ignore because of allow_invalid flag
}
}
quote! {}
} else {
quote! {
_ => {
// invalid field name
return Err(XmlDeError::InvalidFieldName)
}
}
quote! { return Err(XmlDeError::InvalidFieldName) }
}
}
@@ -114,7 +105,7 @@ impl NamedStruct {
let attr = attr?;
match attr.key.as_ref() {
#(#attr_field_branches)*
#invalid_field_branch
_ => { #invalid_field_branch }
}
}
@@ -133,7 +124,7 @@ impl NamedStruct {
match (ns, name.as_ref()) {
#(#named_field_branches)*
#(#untagged_field_branches)*
#invalid_field_branch
_ => { #invalid_field_branch }
}
}
Event::Text(bytes_text) => {