mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-29 21:14:18 +00:00
formatting fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
034dd3fe5e
commit
dd767723d8
@ -109,7 +109,10 @@ fn derive_named_struct_updatable(
|
|||||||
.expect("unnamed field in named struct?");
|
.expect("unnamed field in named struct?");
|
||||||
|
|
||||||
let field_name_string = field_name.to_string();
|
let field_name_string = field_name.to_string();
|
||||||
let build_err = format!("failed to build value for field '{}': {{}}", field_name_string);
|
let build_err = format!(
|
||||||
|
"failed to build value for field '{}': {{}}",
|
||||||
|
field_name_string
|
||||||
|
);
|
||||||
if util::is_option_type(&field.ty).is_some() {
|
if util::is_option_type(&field.ty).is_some() {
|
||||||
delete.extend(quote! {
|
delete.extend(quote! {
|
||||||
#field_name_string => { self.#field_name = None; }
|
#field_name_string => { self.#field_name = None; }
|
||||||
@ -130,8 +133,10 @@ fn derive_named_struct_updatable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if attrs.fixed {
|
if attrs.fixed {
|
||||||
let error =
|
let error = format!(
|
||||||
format!("field '{}' must not be set when updating existing data", field_name);
|
"field '{}' must not be set when updating existing data",
|
||||||
|
field_name
|
||||||
|
);
|
||||||
apply.extend(quote! {
|
apply.extend(quote! {
|
||||||
if from.#field_name.is_some() {
|
if from.#field_name.is_some() {
|
||||||
::anyhow::bail!(#error);
|
::anyhow::bail!(#error);
|
||||||
@ -274,13 +279,11 @@ where
|
|||||||
fn meta_iter(
|
fn meta_iter(
|
||||||
attributes: impl IntoIterator<Item = syn::Attribute>,
|
attributes: impl IntoIterator<Item = syn::Attribute>,
|
||||||
) -> impl Iterator<Item = syn::Meta> {
|
) -> impl Iterator<Item = syn::Meta> {
|
||||||
attributes
|
attributes.into_iter().filter_map(|attr| {
|
||||||
.into_iter()
|
if attr.style != syn::AttrStyle::Outer {
|
||||||
.filter_map(|attr| {
|
return None;
|
||||||
if attr.style != syn::AttrStyle::Outer {
|
}
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
attr.parse_meta().ok()
|
attr.parse_meta().ok()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user