forked from Proxmox/proxmox
formatting cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
061cc5b525
commit
ce5fa31721
@ -142,10 +142,9 @@ impl ParameterDefinition {
|
||||
syn::Lit::Str(description) => Ok(ParameterDefinition::builder()
|
||||
.description(Some(description))
|
||||
.build()
|
||||
.map_err(|e| c_format_err!(span, "{}", e))?
|
||||
),
|
||||
.map_err(|e| c_format_err!(span, "{}", e))?),
|
||||
_ => c_bail!(span, "expected description or field definition"),
|
||||
}
|
||||
},
|
||||
Expression::Object(obj) => ParameterDefinition::from_object(obj),
|
||||
_ => c_bail!(span, "expected description or field definition"),
|
||||
}
|
||||
|
@ -483,7 +483,8 @@ fn handle_struct_named(
|
||||
item: &syn::FieldsNamed,
|
||||
) -> Result<TokenStream, Error> {
|
||||
let common = CommonTypeDefinition::from_object(&mut definition)?;
|
||||
let mut field_def = definition.remove("fields")
|
||||
let mut field_def = definition
|
||||
.remove("fields")
|
||||
.ok_or_else(|| c_format_err!(definition.span(), "missing 'fields' entry"))?
|
||||
.expect_object()?;
|
||||
|
||||
@ -510,16 +511,15 @@ fn handle_struct_named(
|
||||
for field in item.named.iter() {
|
||||
mem_id += 1;
|
||||
|
||||
let field_ident = field.ident
|
||||
let field_ident = field
|
||||
.ident
|
||||
.as_ref()
|
||||
.ok_or_else(|| c_format_err!(field => "missing field name"))?;
|
||||
let field_s = field_ident.to_string();
|
||||
|
||||
let def = field_def
|
||||
.remove(&field_s)
|
||||
.ok_or_else(|| {
|
||||
c_format_err!(field => "missing api description entry for field {}", field_s)
|
||||
})?;
|
||||
let def = field_def.remove(&field_s).ok_or_else(
|
||||
|| c_format_err!(field => "missing api description entry for field {}", field_s),
|
||||
)?;
|
||||
let def = ParameterDefinition::from_expression(def)?;
|
||||
|
||||
let field_span = field_ident.span();
|
||||
|
@ -1,8 +1,8 @@
|
||||
use proc_macro2::Ident;
|
||||
|
||||
use syn::{parenthesized, Token};
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::{parenthesized, Token};
|
||||
|
||||
macro_rules! c_format_err {
|
||||
($span:expr => $($msg:tt)*) => { syn::Error::new_spanned($span, format!($($msg)*)) };
|
||||
|
Loading…
Reference in New Issue
Block a user