mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 14:02:29 +00:00
xml: tiny refactoring
This commit is contained in:
@@ -70,13 +70,12 @@ impl NamedStruct {
|
|||||||
.ns_prefix
|
.ns_prefix
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(ns, prefix)| {
|
.map(|(ns, prefix)| {
|
||||||
let sep = if !prefix.value().is_empty() {
|
let attr_name = if prefix.value().is_empty() {
|
||||||
b":".to_vec()
|
"xmlns".to_owned()
|
||||||
} else {
|
} else {
|
||||||
b"".to_vec()
|
format!("xmlns:{}", prefix.value())
|
||||||
};
|
};
|
||||||
let attr_name = [b"xmlns".as_ref(), &sep, prefix.value().as_bytes()].concat();
|
let a = syn::LitByteStr::new(attr_name.as_bytes(), prefix.span());
|
||||||
let a = syn::LitByteStr::new(&attr_name, prefix.span());
|
|
||||||
quote! {
|
quote! {
|
||||||
bytes_start.push_attribute((#a.as_ref(), #ns.as_ref()));
|
bytes_start.push_attribute((#a.as_ref(), #ns.as_ref()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user