From a17430b38fd8d477db1248b05a9fe6d776333259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 5 Jun 2024 13:31:06 +0200 Subject: [PATCH] run `cargo fmt` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (again) Signed-off-by: Fabian Grünbichler --- proxmox-acme-api/src/account_config.rs | 9 ++--- proxmox-acme-api/src/acme_plugin.rs | 2 +- proxmox-acme-api/src/init.rs | 2 +- proxmox-acme-api/src/lib.rs | 4 +-- proxmox-acme-api/src/plugin_api_impl.rs | 7 ++-- proxmox-acme-api/src/plugin_config.rs | 4 +-- proxmox-acme-api/src/types.rs | 2 +- proxmox-acme/src/account.rs | 2 +- proxmox-acme/src/eab.rs | 2 +- proxmox-acme/src/lib.rs | 48 ++++++++++++------------- proxmox-acme/src/types.rs | 2 +- proxmox-client/src/client.rs | 6 ++-- proxmox-network-api/src/api_types.rs | 11 +++--- proxmox-section-config/src/lib.rs | 14 ++++++-- proxmox-syslog-api/src/api_types.rs | 2 +- 15 files changed, 56 insertions(+), 61 deletions(-) diff --git a/proxmox-acme-api/src/account_config.rs b/proxmox-acme-api/src/account_config.rs index df011b9f..0ced6926 100644 --- a/proxmox-acme-api/src/account_config.rs +++ b/proxmox-acme-api/src/account_config.rs @@ -8,8 +8,8 @@ use std::path::{Path, PathBuf}; use anyhow::{bail, format_err, Error}; use serde::{Deserialize, Serialize}; -use proxmox_sys::error::SysError; use proxmox_product_config::replace_secret_config; +use proxmox_sys::error::SysError; use proxmox_schema::api_types::SAFE_ID_REGEX; @@ -17,8 +17,8 @@ use proxmox_acme::async_client::AcmeClient; use proxmox_acme::types::AccountData as AcmeAccountData; use proxmox_acme::Account; -use crate::types::AcmeAccountName; use crate::acme_account_dir; +use crate::types::AcmeAccountName; #[inline] fn is_false(b: &bool) -> bool { @@ -208,8 +208,5 @@ pub(crate) fn save_account_config( ) })?; - replace_secret_config( - account_config_filename, - &data, - ) + replace_secret_config(account_config_filename, &data) } diff --git a/proxmox-acme-api/src/acme_plugin.rs b/proxmox-acme-api/src/acme_plugin.rs index fe6dee3e..cd4012f5 100644 --- a/proxmox-acme-api/src/acme_plugin.rs +++ b/proxmox-acme-api/src/acme_plugin.rs @@ -15,8 +15,8 @@ use proxmox_acme::async_client::AcmeClient; use proxmox_acme::{Authorization, Challenge}; use proxmox_rest_server::WorkerTask; -use crate::types::{AcmeDomain, DnsPlugin}; use crate::plugin_config::PluginData; +use crate::types::{AcmeDomain, DnsPlugin}; const PROXMOX_ACME_SH_PATH: &str = "/usr/share/proxmox-acme/proxmox-acme"; diff --git a/proxmox-acme-api/src/init.rs b/proxmox-acme-api/src/init.rs index 4869da29..b23e49ea 100644 --- a/proxmox-acme-api/src/init.rs +++ b/proxmox-acme-api/src/init.rs @@ -52,4 +52,4 @@ pub(crate) fn plugin_cfg_filename() -> PathBuf { pub(crate) fn plugin_cfg_lockfile() -> PathBuf { acme_config_dir().join("plugins.lck") -} \ No newline at end of file +} diff --git a/proxmox-acme-api/src/lib.rs b/proxmox-acme-api/src/lib.rs index 5e9ea3f4..3230f8cf 100644 --- a/proxmox-acme-api/src/lib.rs +++ b/proxmox-acme-api/src/lib.rs @@ -15,7 +15,7 @@ pub use config::{DEFAULT_ACME_DIRECTORY_ENTRY, KNOWN_ACME_DIRECTORIES}; #[cfg(feature = "impl")] mod challenge_schemas; #[cfg(feature = "impl")] -pub use challenge_schemas::{ChallengeSchemaWrapper, get_cached_challenge_schemas}; +pub use challenge_schemas::{get_cached_challenge_schemas, ChallengeSchemaWrapper}; #[cfg(feature = "impl")] mod account_config; @@ -37,11 +37,9 @@ mod plugin_api_impl; #[cfg(feature = "impl")] pub use plugin_api_impl::{add_plugin, delete_plugin, get_plugin, list_plugins, update_plugin}; - #[cfg(feature = "impl")] pub(crate) mod acme_plugin; - #[cfg(feature = "impl")] mod certificate_helpers; #[cfg(feature = "impl")] diff --git a/proxmox-acme-api/src/plugin_api_impl.rs b/proxmox-acme-api/src/plugin_api_impl.rs index e01ffe1d..9aa8a4c3 100644 --- a/proxmox-acme-api/src/plugin_api_impl.rs +++ b/proxmox-acme-api/src/plugin_api_impl.rs @@ -5,8 +5,8 @@ use anyhow::{bail, format_err, Error}; use serde::Deserialize; use serde_json::Value; -use proxmox_schema::param_bail; use proxmox_config_digest::ConfigDigest; +use proxmox_schema::param_bail; use crate::types::{ DeletablePluginProperty, DnsPlugin, DnsPluginCore, DnsPluginCoreUpdater, PluginConfig, @@ -24,10 +24,7 @@ pub fn list_plugins(rpcenv: &mut dyn RpcEnvironment) -> Result .collect()) } -pub fn get_plugin( - id: String, - rpcenv: &mut dyn RpcEnvironment, -) -> Result { +pub fn get_plugin(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result { let (plugins, digest) = super::plugin_config::plugin_config()?; rpcenv["digest"] = digest.to_hex().into(); diff --git a/proxmox-acme-api/src/plugin_config.rs b/proxmox-acme-api/src/plugin_config.rs index ee1df49e..4ebd0315 100644 --- a/proxmox-acme-api/src/plugin_config.rs +++ b/proxmox-acme-api/src/plugin_config.rs @@ -4,10 +4,10 @@ use anyhow::Error; use lazy_static::lazy_static; use serde_json::Value; +use proxmox_config_digest::ConfigDigest; +use proxmox_product_config::{open_api_lockfile, replace_secret_config, ApiLockGuard}; use proxmox_schema::{ApiType, Schema}; use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin}; -use proxmox_config_digest::ConfigDigest; -use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_secret_config}; use crate::types::{DnsPlugin, StandalonePlugin, PLUGIN_ID_SCHEMA}; diff --git a/proxmox-acme-api/src/types.rs b/proxmox-acme-api/src/types.rs index 57ad7103..d46497ca 100644 --- a/proxmox-acme-api/src/types.rs +++ b/proxmox-acme-api/src/types.rs @@ -6,8 +6,8 @@ use anyhow::Error; use serde::{Deserialize, Serialize}; use serde_json::Value; -use proxmox_schema::{api, ApiStringFormat, ApiType, Schema, StringSchema, Updater}; use proxmox_schema::api_types::{DNS_ALIAS_FORMAT, DNS_NAME_FORMAT, SAFE_ID_FORMAT}; +use proxmox_schema::{api, ApiStringFormat, ApiType, Schema, StringSchema, Updater}; use proxmox_acme::types::AccountData as AcmeAccountData; diff --git a/proxmox-acme/src/account.rs b/proxmox-acme/src/account.rs index 89119c9a..112a2ad9 100644 --- a/proxmox-acme/src/account.rs +++ b/proxmox-acme/src/account.rs @@ -11,11 +11,11 @@ use serde_json::Value; use crate::authorization::{Authorization, GetAuthorization}; use crate::b64u; use crate::directory::Directory; -use crate::types::{AccountData, AccountStatus, ExternalAccountBinding}; use crate::jws::Jws; use crate::key::{Jwk, PublicKey}; use crate::order::{NewOrder, Order, OrderData}; use crate::request::Request; +use crate::types::{AccountData, AccountStatus, ExternalAccountBinding}; use crate::Error; /// An ACME Account. diff --git a/proxmox-acme/src/eab.rs b/proxmox-acme/src/eab.rs index cf71aef4..3e0d2816 100644 --- a/proxmox-acme/src/eab.rs +++ b/proxmox-acme/src/eab.rs @@ -5,8 +5,8 @@ use openssl::sign::Signer; use serde::Serialize; use crate::key::Jwk; -use crate::{b64u, Error}; use crate::types::ExternalAccountBinding; +use crate::{b64u, Error}; #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/proxmox-acme/src/lib.rs b/proxmox-acme/src/lib.rs index 80e5ab14..b0374ecd 100644 --- a/proxmox-acme/src/lib.rs +++ b/proxmox-acme/src/lib.rs @@ -13,70 +13,66 @@ #![deny(missing_docs)] -#[cfg(feature="api-types")] +#[cfg(feature = "api-types")] pub mod types; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod b64u; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod eab; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod json; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod jws; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod key; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] mod request; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] pub mod account; -#[cfg(feature="impl")] - +#[cfg(feature = "impl")] pub mod authorization; -#[cfg(feature="impl")] - +#[cfg(feature = "impl")] pub mod directory; -#[cfg(feature="impl")] - +#[cfg(feature = "impl")] pub mod error; -#[cfg(feature="impl")] - -#[cfg(feature="impl")] +#[cfg(feature = "impl")] +#[cfg(feature = "impl")] pub mod order; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] pub mod util; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use account::Account; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use authorization::{Authorization, Challenge}; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use directory::Directory; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use error::Error; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use order::Order; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] #[doc(inline)] pub use request::Request; // we don't inline these: -#[cfg(feature="impl")] +#[cfg(feature = "impl")] pub use order::NewOrder; -#[cfg(feature="impl")] +#[cfg(feature = "impl")] pub use request::ErrorResponse; /// Header name for nonces. diff --git a/proxmox-acme/src/types.rs b/proxmox-acme/src/types.rs index f1053518..9a1650ff 100644 --- a/proxmox-acme/src/types.rs +++ b/proxmox-acme/src/types.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg_attr(feature="api-types", proxmox_schema::api())] +#[cfg_attr(feature = "api-types", proxmox_schema::api())] /// External Account Bindings #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(rename_all = "camelCase")] diff --git a/proxmox-client/src/client.rs b/proxmox-client/src/client.rs index 5a75f010..1cae2883 100644 --- a/proxmox-client/src/client.rs +++ b/proxmox-client/src/client.rs @@ -455,9 +455,9 @@ impl HttpApiClient for Client { fn verify_fingerprint(chain: &x509::X509StoreContextRef, expected_fingerprint: &[u8]) -> bool { let Some(cert) = chain.current_cert() else { - log::error!("no certificate in chain?"); - return false; - }; + log::error!("no certificate in chain?"); + return false; + }; let fp = match cert.digest(MessageDigest::sha256()) { Err(err) => { diff --git a/proxmox-network-api/src/api_types.rs b/proxmox-network-api/src/api_types.rs index cc90a8f8..ba1615e0 100644 --- a/proxmox-network-api/src/api_types.rs +++ b/proxmox-network-api/src/api_types.rs @@ -7,13 +7,13 @@ use lazy_static::lazy_static; use regex::Regex; use proxmox_schema::api; +use proxmox_schema::api_types::SAFE_ID_REGEX; +use proxmox_schema::api_types::{CIDR_V4_SCHEMA, CIDR_V6_SCHEMA}; +use proxmox_schema::api_types::{IP_V4_SCHEMA, IP_V6_SCHEMA}; use proxmox_schema::ApiStringFormat; use proxmox_schema::ArraySchema; use proxmox_schema::Schema; use proxmox_schema::StringSchema; -use proxmox_schema::api_types::SAFE_ID_REGEX; -use proxmox_schema::api_types::{IP_V4_SCHEMA, IP_V6_SCHEMA}; -use proxmox_schema::api_types::{CIDR_V4_SCHEMA, CIDR_V6_SCHEMA}; lazy_static! { pub static ref PHYSICAL_NIC_REGEX: Regex = Regex::new(r"^(?:eth\d+|en[^:.]+|ib\d+)$").unwrap(); @@ -21,8 +21,7 @@ lazy_static! { Regex::new(r"^(?P\S+)\.(?P\d+)|vlan(?P\d+)$").unwrap(); } -pub const NETWORK_INTERFACE_FORMAT: ApiStringFormat = - ApiStringFormat::Pattern(&SAFE_ID_REGEX); +pub const NETWORK_INTERFACE_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&SAFE_ID_REGEX); #[api()] #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -504,7 +503,7 @@ pub enum DeletableInterfaceProperty { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] /// Update network interface config. -pub struct InterfaceUpdater { +pub struct InterfaceUpdater { #[serde(rename = "type")] pub interface_type: Option, pub autostart: Option, diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs index 2e9d237b..526ee8f1 100644 --- a/proxmox-section-config/src/lib.rs +++ b/proxmox-section-config/src/lib.rs @@ -18,9 +18,9 @@ //! ... //! ``` -use std::path::Path; use std::collections::HashMap; use std::collections::HashSet; +use std::path::Path; use anyhow::{bail, format_err, Error}; use serde::de::DeserializeOwned; @@ -307,7 +307,11 @@ impl SectionConfig { /// This verifies the whole data using the schemas defined in the /// plugins. Please note that `filename` is only used to improve /// error messages. - pub fn write>(&self, filename: P, config: &SectionConfigData) -> Result { + pub fn write>( + &self, + filename: P, + config: &SectionConfigData, + ) -> Result { self.write_do(config) .map_err(|e: Error| format_err!("writing {:?} failed: {}", filename.as_ref(), e)) } @@ -394,7 +398,11 @@ impl SectionConfig { /// This verifies the whole data using the schemas defined in the /// plugins. Please note that `filename` is only used to improve /// error messages. - pub fn parse>(&self, filename: P, raw: &str) -> Result { + pub fn parse>( + &self, + filename: P, + raw: &str, + ) -> Result { let mut state = ParseState::BeforeHeader; let test_required_properties = |value: &Value, diff --git a/proxmox-syslog-api/src/api_types.rs b/proxmox-syslog-api/src/api_types.rs index 8bf99cac..1a5702d6 100644 --- a/proxmox-syslog-api/src/api_types.rs +++ b/proxmox-syslog-api/src/api_types.rs @@ -55,4 +55,4 @@ pub struct SyslogLine { pub n: u64, /// Line text. pub t: String, -} \ No newline at end of file +}