macro: fix enum verify method

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-08-12 14:00:59 +02:00
parent 37cf2e6208
commit 50f5115718

View File

@ -101,11 +101,10 @@ pub fn handle_enum(mut definition: Object, item: &mut syn::ItemEnum) -> Result<T
c_bail!(unnamed.span(), "#[api] enums variants may have at most 1 element");
}
let field = unnamed.first().unwrap();
let field = field.value();
let field_ty = &field.ty;
verify_entries.extend(quote_spanned! { unnamed.span() =>
#enum_ident::#field_ty(ref inner) => ::proxmox::api::ApiType::verify(inner),
#enum_ident::#variant_ident(ref inner) => {
::proxmox::api::ApiType::verify(inner)
}
});
}
}