rustfmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
744d69c2ab
commit
917ce00dd6
@ -147,9 +147,9 @@ impl Schema {
|
||||
/// Create the token stream for a reference schema (`ExternType` or `ExternSchema`).
|
||||
fn to_schema_reference(&self) -> Option<TokenStream> {
|
||||
match &self.item {
|
||||
SchemaItem::ExternType(path) => {
|
||||
Some(quote_spanned! { path.span() => &<#path as ::proxmox::api::schema::ApiType>::API_SCHEMA })
|
||||
}
|
||||
SchemaItem::ExternType(path) => Some(
|
||||
quote_spanned! { path.span() => &<#path as ::proxmox::api::schema::ApiType>::API_SCHEMA },
|
||||
),
|
||||
SchemaItem::ExternSchema(path) => Some(quote_spanned! { path.span() => &#path }),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -302,7 +302,11 @@ pub fn derive_updater(_item: TokenStream_1) -> TokenStream_1 {
|
||||
pub fn derive_updater_type(item: TokenStream_1) -> TokenStream_1 {
|
||||
let _error_guard = init_local_error();
|
||||
let item: TokenStream = item.into();
|
||||
handle_error(item.clone(), updater::updater_type(item).map_err(Error::from)).into()
|
||||
handle_error(
|
||||
item.clone(),
|
||||
updater::updater_type(item).map_err(Error::from),
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
thread_local!(static NON_FATAL_ERRORS: RefCell<Option<TokenStream>> = RefCell::new(None));
|
||||
|
@ -7,14 +7,10 @@ pub(crate) fn updater_type(item: TokenStream) -> Result<TokenStream, syn::Error>
|
||||
let full_span = item.span();
|
||||
Ok(match item {
|
||||
syn::Item::Struct(syn::ItemStruct {
|
||||
ident,
|
||||
generics,
|
||||
..
|
||||
ident, generics, ..
|
||||
}) => derive_updater_type(full_span, ident, generics),
|
||||
syn::Item::Enum(syn::ItemEnum {
|
||||
ident,
|
||||
generics,
|
||||
..
|
||||
ident, generics, ..
|
||||
}) => derive_updater_type(full_span, ident, generics),
|
||||
_ => bail!(item => "`UpdaterType` cannot be derived for this type"),
|
||||
})
|
||||
@ -28,11 +24,7 @@ fn no_generics(generics: syn::Generics) {
|
||||
}
|
||||
}
|
||||
|
||||
fn derive_updater_type(
|
||||
full_span: Span,
|
||||
ident: Ident,
|
||||
generics: syn::Generics,
|
||||
) -> TokenStream {
|
||||
fn derive_updater_type(full_span: Span, ident: Ident, generics: syn::Generics) -> TokenStream {
|
||||
no_generics(generics);
|
||||
|
||||
quote_spanned! { full_span =>
|
||||
|
Loading…
Reference in New Issue
Block a user