mirror of
https://gitlab.cern.ch/wotsubo/endcap-sl-software-ri-generator.git
synced 2025-08-05 02:09:25 +09:00
update(generator): remove Value docs if desc is None or empty
This commit is contained in:
parent
215204e168
commit
26b716f549
1 changed files with 6 additions and 2 deletions
|
@ -349,10 +349,14 @@ fn generate_custom_values_const_enumdef(
|
|||
}
|
||||
});
|
||||
let variants = values.iter().map(|value| {
|
||||
let desc = value.desc.clone().unwrap_or("".to_string());
|
||||
let doc = match value.desc {
|
||||
None => quote! {},
|
||||
Some(ref s) if s.is_empty() => quote! {},
|
||||
Some(ref desc) => quote! { #[doc = #desc] },
|
||||
};
|
||||
let variant_name = util::parse_to_ident(&value.name.to_upper_camel_case()).unwrap();
|
||||
quote! {
|
||||
#[doc = #desc]
|
||||
#doc
|
||||
#variant_name
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue