From 917ce00dd666a544f2337f0db4339cfc25a42a3b Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 13 Aug 2021 13:31:57 +0200 Subject: [PATCH] rustfmt Signed-off-by: Wolfgang Bumiller --- proxmox-api-macro/src/api/mod.rs | 6 +++--- proxmox-api-macro/src/lib.rs | 6 +++++- proxmox-api-macro/src/updater.rs | 14 +++----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/proxmox-api-macro/src/api/mod.rs b/proxmox-api-macro/src/api/mod.rs index 26b8e437..138b82b5 100644 --- a/proxmox-api-macro/src/api/mod.rs +++ b/proxmox-api-macro/src/api/mod.rs @@ -147,9 +147,9 @@ impl Schema { /// Create the token stream for a reference schema (`ExternType` or `ExternSchema`). fn to_schema_reference(&self) -> Option { 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, } diff --git a/proxmox-api-macro/src/lib.rs b/proxmox-api-macro/src/lib.rs index 9c35eeff..9f562627 100644 --- a/proxmox-api-macro/src/lib.rs +++ b/proxmox-api-macro/src/lib.rs @@ -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> = RefCell::new(None)); diff --git a/proxmox-api-macro/src/updater.rs b/proxmox-api-macro/src/updater.rs index aad0e95c..85c671d3 100644 --- a/proxmox-api-macro/src/updater.rs +++ b/proxmox-api-macro/src/updater.rs @@ -7,14 +7,10 @@ pub(crate) fn updater_type(item: TokenStream) -> Result 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 =>