add README description

This commit is contained in:
2024-04-15 21:05:19 +02:00
parent babd99d24c
commit 3ad76d1c00
2 changed files with 45 additions and 7 deletions

View File

@ -62,7 +62,6 @@ fn generate_helper_struct(
let mut new_type_miniconf_names = vec![];
let mut new_type_miniconf_consts = vec![];
let mut extra_new_checks = TokenStream2::new();
let mut generate_new_type = false;
for attr in &field.attrs {
if let Some((new_type_impl, new_check, const_ident, key)) =
parse_min(&new_type_ident, attr, &ty)
@ -71,7 +70,6 @@ fn generate_helper_struct(
new_type_miniconf_consts.push(const_ident);
new_type_miniconf_names.push(key);
extra_new_checks.extend(new_check);
generate_new_type = true;
}
if let Some((new_type_impl, new_check, const_ident, key)) =
parse_max(&new_type_ident, attr, &ty)
@ -80,13 +78,11 @@ fn generate_helper_struct(
new_type_miniconf_consts.push(const_ident);
new_type_miniconf_names.push(key);
extra_new_checks.extend(new_check);
generate_new_type = true;
}
if let Some((new_type_impl, const_ident, key)) = parse_default(&new_type_ident, attr, &ty) {
new_type_impls.extend(new_type_impl);
new_type_miniconf_consts.push(const_ident);
new_type_miniconf_names.push(key);
generate_new_type = true;
}
if let Some((new_type_impl, const_ident, key)) = parse_description(&new_type_ident, attr) {
new_type_impls.extend(new_type_impl);
@ -94,7 +90,7 @@ fn generate_helper_struct(
new_type_miniconf_names.push(key);
}
}
if !generate_new_type {
if new_type_miniconf_names.is_empty() {
return None;
}
field.attrs.retain(|attr| {