run cargo fmt

(again)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-06-05 13:31:06 +02:00
parent 7ab17e262c
commit a17430b38f
15 changed files with 56 additions and 61 deletions

View File

@ -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)
}

View File

@ -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";

View File

@ -52,4 +52,4 @@ pub(crate) fn plugin_cfg_filename() -> PathBuf {
pub(crate) fn plugin_cfg_lockfile() -> PathBuf {
acme_config_dir().join("plugins.lck")
}
}

View File

@ -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")]

View File

@ -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<Vec<PluginConfig>
.collect())
}
pub fn get_plugin(
id: String,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<PluginConfig, Error> {
pub fn get_plugin(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<PluginConfig, Error> {
let (plugins, digest) = super::plugin_config::plugin_config()?;
rpcenv["digest"] = digest.to_hex().into();

View File

@ -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};

View File

@ -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;

View File

@ -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.

View File

@ -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")]

View File

@ -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.

View File

@ -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")]

View File

@ -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) => {

View File

@ -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<vlan_raw_device>\S+)\.(?P<vlan_id>\d+)|vlan(?P<vlan_id2>\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<NetworkInterfaceType>,
pub autostart: Option<bool>,

View File

@ -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<P: AsRef<Path>>(&self, filename: P, config: &SectionConfigData) -> Result<String, Error> {
pub fn write<P: AsRef<Path>>(
&self,
filename: P,
config: &SectionConfigData,
) -> Result<String, Error> {
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<P: AsRef<Path>>(&self, filename: P, raw: &str) -> Result<SectionConfigData, Error> {
pub fn parse<P: AsRef<Path>>(
&self,
filename: P,
raw: &str,
) -> Result<SectionConfigData, Error> {
let mut state = ParseState::BeforeHeader;
let test_required_properties = |value: &Value,

View File

@ -55,4 +55,4 @@ pub struct SyslogLine {
pub n: u64,
/// Line text.
pub t: String,
}
}