From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 7/9] run rustfmt with edition 2024
Date: Tue, 4 Mar 2025 15:40:49 +0100 [thread overview]
Message-ID: <20250304144051.585163-7-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250304144051.585163-1-m.sandoval@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pbs-api-types/src/acl.rs | 4 +-
pbs-api-types/src/ad.rs | 4 +-
pbs-api-types/src/datastore.rs | 16 ++---
pbs-api-types/src/jobs.rs | 17 +++--
pbs-api-types/src/ldap.rs | 5 +-
pbs-api-types/src/lib.rs | 20 +++---
pbs-api-types/src/maintenance.rs | 4 +-
pbs-api-types/src/metrics.rs | 2 +-
pbs-api-types/src/openid.rs | 2 +-
pbs-api-types/src/pathpatterns.rs | 2 +-
pbs-api-types/src/percent_encoding.rs | 2 +-
pbs-api-types/src/tape/changer.rs | 2 +-
pbs-api-types/src/tape/drive.rs | 6 +-
pbs-api-types/src/tape/media_location.rs | 2 +-
pbs-api-types/src/tape/media_pool.rs | 2 +-
pbs-api-types/src/tape/mod.rs | 4 +-
pbs-api-types/src/traffic_control.rs | 2 +-
pbs-api-types/src/user.rs | 4 +-
pbs-api-types/src/version.rs | 2 +-
proxmox-access-control/src/acl.rs | 27 ++++----
.../src/cached_user_info.rs | 2 +-
proxmox-access-control/src/init.rs | 2 +-
proxmox-access-control/src/token_shadow.rs | 6 +-
proxmox-access-control/src/types.rs | 5 +-
proxmox-access-control/src/user.rs | 4 +-
proxmox-acme-api/src/account_config.rs | 4 +-
proxmox-acme-api/src/acme_plugin.rs | 2 +-
proxmox-acme-api/src/certificate_helpers.rs | 6 +-
proxmox-acme-api/src/lib.rs | 2 +-
proxmox-acme-api/src/plugin_api_impl.rs | 4 +-
proxmox-acme-api/src/plugin_config.rs | 4 +-
proxmox-acme-api/src/types.rs | 2 +-
proxmox-acme/src/account.rs | 2 +-
proxmox-acme/src/async_client.rs | 2 +-
proxmox-acme/src/authorization.rs | 2 +-
proxmox-acme/src/eab.rs | 2 +-
proxmox-acme/src/jws.rs | 2 +-
proxmox-acme/src/key.rs | 2 +-
proxmox-acme/src/order.rs | 2 +-
proxmox-api-macro/src/api/enums.rs | 2 +-
proxmox-api-macro/src/api/method.rs | 12 ++--
proxmox-api-macro/src/api/mod.rs | 2 +-
proxmox-api-macro/src/api/structs.rs | 2 +-
proxmox-api-macro/src/serde.rs | 2 +-
proxmox-api-macro/src/util.rs | 2 +-
proxmox-api-macro/tests/allof.rs | 2 +-
proxmox-api-macro/tests/api1.rs | 2 +-
proxmox-api-macro/tests/ext-schema.rs | 2 +-
proxmox-api-macro/tests/options.rs | 2 +-
proxmox-api-macro/tests/updater.rs | 2 +-
proxmox-apt/src/api.rs | 2 +-
proxmox-apt/src/cache.rs | 4 +-
proxmox-apt/src/cache_api.rs | 2 +-
proxmox-apt/src/deb822/mod.rs | 2 +-
proxmox-apt/src/deb822/packages_file.rs | 2 +-
proxmox-apt/src/deb822/release_file.rs | 2 +-
proxmox-apt/src/deb822/sources_file.rs | 2 +-
proxmox-apt/src/repositories/file.rs | 2 +-
.../src/repositories/file/list_parser.rs | 2 +-
.../src/repositories/file/sources_parser.rs | 2 +-
proxmox-apt/src/repositories/mod.rs | 4 +-
proxmox-apt/src/repositories/release.rs | 2 +-
proxmox-apt/src/repositories/repository.rs | 2 +-
proxmox-apt/tests/repositories.rs | 6 +-
proxmox-async/src/broadcast_future.rs | 4 +-
proxmox-auth-api/examples/passwd.rs | 2 +-
proxmox-auth-api/src/api/access.rs | 8 +--
proxmox-auth-api/src/api/mod.rs | 6 +-
proxmox-auth-api/src/api/ticket.rs | 2 +-
proxmox-auth-api/src/auth_key.rs | 8 +--
proxmox-auth-api/src/pam_authenticator.rs | 4 +-
.../src/password_authenticator.rs | 2 +-
proxmox-auth-api/src/ticket.rs | 4 +-
proxmox-auth-api/src/types.rs | 4 +-
proxmox-client/src/client.rs | 2 +-
proxmox-compression/src/zip.rs | 2 +-
proxmox-compression/src/zstd.rs | 2 +-
proxmox-config-digest/src/lib.rs | 4 +-
proxmox-daemon/src/command_socket.rs | 2 +-
proxmox-daemon/src/server.rs | 6 +-
proxmox-daemon/src/state.rs | 6 +-
proxmox-dns-api/src/api_types.rs | 4 +-
proxmox-dns-api/src/resolv_conf.rs | 2 +-
proxmox-http-error/src/lib.rs | 2 +-
proxmox-http/src/client/connector.rs | 2 +-
proxmox-http/src/client/simple.rs | 8 +--
proxmox-http/src/proxy_config.rs | 2 +-
proxmox-http/src/rate_limiter.rs | 2 +-
proxmox-http/src/uri.rs | 2 +-
proxmox-http/src/websocket/mod.rs | 4 +-
proxmox-human-byte/src/lib.rs | 2 +-
proxmox-io/src/lib.rs | 2 +-
proxmox-lang/src/lib.rs | 4 +-
proxmox-ldap/src/lib.rs | 2 +-
proxmox-ldap/tests/glauth.rs | 15 +++--
proxmox-log/src/file_logger.rs | 2 +-
proxmox-log/src/lib.rs | 2 +-
proxmox-log/src/tasklog_layer.rs | 6 +-
proxmox-metrics/src/influxdb/http.rs | 4 +-
proxmox-metrics/src/influxdb/utils.rs | 2 +-
proxmox-metrics/src/lib.rs | 2 +-
proxmox-network-api/src/api_impl.rs | 8 ++-
proxmox-network-api/src/api_types.rs | 10 +--
proxmox-network-api/src/config/helper.rs | 4 +-
proxmox-network-api/src/config/mod.rs | 6 +-
proxmox-network-api/src/config/parser.rs | 4 +-
proxmox-notify/src/api/gotify.rs | 46 +++++++------
proxmox-notify/src/api/matcher.rs | 22 ++++---
proxmox-notify/src/api/sendmail.rs | 36 ++++++-----
proxmox-notify/src/api/smtp.rs | 46 +++++++------
proxmox-notify/src/api/webhook.rs | 33 +++++-----
proxmox-notify/src/config.rs | 22 +++----
proxmox-notify/src/context/pbs.rs | 2 +-
proxmox-notify/src/context/pve.rs | 2 +-
proxmox-notify/src/context/test.rs | 2 +-
proxmox-notify/src/endpoints/gotify.rs | 4 +-
proxmox-notify/src/endpoints/sendmail.rs | 4 +-
proxmox-notify/src/endpoints/smtp.rs | 8 +--
proxmox-notify/src/endpoints/webhook.rs | 6 +-
proxmox-notify/src/lib.rs | 4 +-
proxmox-notify/src/matcher.rs | 4 +-
proxmox-notify/src/renderer/mod.rs | 2 +-
proxmox-openid/src/auth_state.rs | 6 +-
proxmox-openid/src/http_client.rs | 2 +-
proxmox-openid/src/lib.rs | 12 ++--
.../examples/minimal-rest-server.rs | 6 +-
proxmox-rest-server/src/api_config.rs | 8 +--
proxmox-rest-server/src/compression.rs | 2 +-
proxmox-rest-server/src/connection.rs | 10 +--
proxmox-rest-server/src/environment.rs | 2 +-
proxmox-rest-server/src/formatter.rs | 2 +-
proxmox-rest-server/src/h2service.rs | 2 +-
proxmox-rest-server/src/lib.rs | 2 +-
proxmox-rest-server/src/rest.rs | 8 +--
proxmox-rest-server/src/worker_task.rs | 6 +-
proxmox-router/src/cli/command.rs | 6 +-
proxmox-router/src/cli/completion.rs | 2 +-
proxmox-router/src/cli/completion_helpers.rs | 2 +-
proxmox-router/src/cli/format.rs | 6 +-
proxmox-router/src/cli/mod.rs | 2 +-
proxmox-router/src/cli/shellword.rs | 2 +-
proxmox-router/src/cli/text_table.rs | 2 +-
proxmox-router/src/error.rs | 2 +-
proxmox-router/src/format.rs | 2 +-
proxmox-router/src/permission.rs | 2 +-
proxmox-router/src/router.rs | 64 +++++++++++--------
proxmox-router/src/stream/parsing.rs | 4 +-
proxmox-rrd/examples/prrd.rs | 10 +--
proxmox-rrd/src/cache.rs | 8 +--
proxmox-rrd/src/cache/journal.rs | 2 +-
proxmox-rrd/src/cache/rrd_map.rs | 2 +-
proxmox-rrd/src/rrd.rs | 4 +-
proxmox-rrd/tests/file_format_test.rs | 2 +-
proxmox-schema/src/de/mod.rs | 6 +-
proxmox-schema/src/de/no_schema.rs | 2 +-
proxmox-schema/src/format.rs | 2 +-
proxmox-schema/src/property_string.rs | 22 ++++---
proxmox-schema/src/schema.rs | 4 +-
proxmox-schema/src/upid.rs | 6 +-
proxmox-schema/tests/schema_verification.rs | 4 +-
proxmox-section-config/src/lib.rs | 6 +-
proxmox-section-config/src/typed.rs | 4 +-
proxmox-sendmail/src/lib.rs | 4 +-
proxmox-serde/src/json.rs | 2 +-
proxmox-shared-cache/src/lib.rs | 2 +-
proxmox-shared-memory/src/lib.rs | 2 +-
proxmox-shared-memory/src/shared_mutex.rs | 4 +-
.../tests/raw_shared_mutex.rs | 2 +-
proxmox-simple-config/src/lib.rs | 2 +-
proxmox-sortable-macro/src/lib.rs | 2 +-
proxmox-subscription/src/check.rs | 6 +-
proxmox-subscription/src/files.rs | 8 +--
proxmox-subscription/src/lib.rs | 2 +-
proxmox-subscription/src/sign.rs | 2 +-
proxmox-subscription/src/subscription_info.rs | 10 +--
proxmox-sys/src/command.rs | 2 +-
proxmox-sys/src/crypt.rs | 2 +-
proxmox-sys/src/fd.rs | 4 +-
proxmox-sys/src/fs/acl.rs | 2 +-
proxmox-sys/src/fs/dir.rs | 4 +-
proxmox-sys/src/fs/file.rs | 4 +-
proxmox-sys/src/fs/mod.rs | 2 +-
proxmox-sys/src/fs/read_dir.rs | 2 +-
proxmox-sys/src/linux/mod.rs | 2 +-
proxmox-sys/src/linux/pid.rs | 2 +-
proxmox-sys/src/linux/procfs/mod.rs | 2 +-
proxmox-sys/src/linux/procfs/mountinfo.rs | 2 +-
proxmox-sys/src/linux/tty.rs | 2 +-
proxmox-sys/src/logrotate.rs | 6 +-
proxmox-sys/src/macros.rs | 4 +-
proxmox-sys/src/process_locker.rs | 2 +-
proxmox-sys/src/systemd.rs | 2 +-
proxmox-systemd/src/journal.rs | 2 +-
proxmox-systemd/src/lib.rs | 2 +-
proxmox-systemd/src/notify.rs | 2 +-
proxmox-tfa/src/api/methods.rs | 2 +-
proxmox-tfa/src/api/mod.rs | 8 +--
proxmox-tfa/src/api/recovery.rs | 2 +-
proxmox-tfa/src/api/webauthn.rs | 4 +-
proxmox-tfa/src/totp.rs | 8 ++-
proxmox-tfa/src/u2f.rs | 6 +-
proxmox-time-api/src/time_impl.rs | 2 +-
proxmox-time/src/calendar_event.rs | 4 +-
proxmox-time/src/daily_duration.rs | 6 +-
proxmox-time/src/parse_helpers.rs | 2 +-
proxmox-time/src/posix.rs | 2 +-
proxmox-time/src/test.rs | 2 +-
proxmox-time/src/time_span.rs | 2 +-
proxmox-time/src/wasm.rs | 2 +-
proxmox-time/src/week_days.rs | 2 +-
proxmox-uuid/src/lib.rs | 4 +-
proxmox-worker-task/src/lib.rs | 2 +-
212 files changed, 555 insertions(+), 521 deletions(-)
diff --git a/pbs-api-types/src/acl.rs b/pbs-api-types/src/acl.rs
index e2f97f06..da27606f 100644
--- a/pbs-api-types/src/acl.rs
+++ b/pbs-api-types/src/acl.rs
@@ -1,12 +1,12 @@
use std::str::FromStr;
use const_format::concatcp;
-use serde::de::{value, IntoDeserializer};
+use serde::de::{IntoDeserializer, value};
use serde::{Deserialize, Serialize};
use proxmox_lang::constnamedbitmap;
use proxmox_schema::{
- api, const_regex, ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema,
+ ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema, api, const_regex,
};
use crate::PROXMOX_SAFE_ID_REGEX_STR;
diff --git a/pbs-api-types/src/ad.rs b/pbs-api-types/src/ad.rs
index 910571a0..bf408f56 100644
--- a/pbs-api-types/src/ad.rs
+++ b/pbs-api-types/src/ad.rs
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, Updater};
+use proxmox_schema::{Updater, api};
use super::{
- LdapMode, LDAP_DOMAIN_SCHEMA, REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA,
+ LDAP_DOMAIN_SCHEMA, LdapMode, REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA,
SYNC_ATTRIBUTES_SCHEMA, SYNC_DEFAULTS_STRING_SCHEMA, USER_CLASSES_SCHEMA,
};
diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index ddd8d3c6..79cb84ba 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -4,21 +4,21 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use const_format::concatcp;
use serde::{Deserialize, Serialize};
use proxmox_schema::{
- api, const_regex, ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType,
- Schema, StringSchema, Updater, UpdaterType,
+ ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType, Schema,
+ StringSchema, Updater, UpdaterType, api, const_regex,
};
use crate::{
- Authid, CryptMode, Fingerprint, GroupFilter, MaintenanceMode, MaintenanceType, Userid,
- BACKUP_ID_RE, BACKUP_NS_RE, BACKUP_TIME_RE, BACKUP_TYPE_RE, DATASTORE_NOTIFY_STRING_SCHEMA,
- GC_SCHEDULE_SCHEMA, GROUP_OR_SNAPSHOT_PATH_REGEX_STR, PROXMOX_SAFE_ID_FORMAT,
- PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA,
- SNAPSHOT_PATH_REGEX_STR, UPID,
+ Authid, BACKUP_ID_RE, BACKUP_NS_RE, BACKUP_TIME_RE, BACKUP_TYPE_RE, CryptMode,
+ DATASTORE_NOTIFY_STRING_SCHEMA, Fingerprint, GC_SCHEDULE_SCHEMA,
+ GROUP_OR_SNAPSHOT_PATH_REGEX_STR, GroupFilter, MaintenanceMode, MaintenanceType,
+ PROXMOX_SAFE_ID_FORMAT, PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX,
+ SINGLE_LINE_COMMENT_SCHEMA, SNAPSHOT_PATH_REGEX_STR, UPID, Userid,
};
const_regex! {
diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
index 04631d92..15dd41b5 100644
--- a/pbs-api-types/src/jobs.rs
+++ b/pbs-api-types/src/jobs.rs
@@ -8,10 +8,11 @@ use serde::{Deserialize, Serialize};
use proxmox_schema::*;
use crate::{
- Authid, BackupNamespace, BackupType, NotificationMode, RateLimitConfig, Userid,
- BACKUP_GROUP_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_NS_RE, DATASTORE_SCHEMA,
- DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA, NS_MAX_DEPTH_REDUCED_SCHEMA, PROXMOX_SAFE_ID_FORMAT,
- PROXMOX_SAFE_ID_REGEX_STR, REMOTE_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA,
+ Authid, BACKUP_GROUP_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_NS_RE, BackupNamespace,
+ BackupType, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
+ NS_MAX_DEPTH_REDUCED_SCHEMA, NotificationMode, PROXMOX_SAFE_ID_FORMAT,
+ PROXMOX_SAFE_ID_REGEX_STR, REMOTE_ID_SCHEMA, RateLimitConfig, SINGLE_LINE_COMMENT_SCHEMA,
+ Userid,
};
const_regex! {
@@ -416,11 +417,15 @@ impl std::str::FromStr for FilterType {
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s.split_once(':') {
- Some(("group", value)) => BACKUP_GROUP_SCHEMA.parse_simple_value(value).map(|_| FilterType::Group(value.to_string()))?,
+ Some(("group", value)) => BACKUP_GROUP_SCHEMA
+ .parse_simple_value(value)
+ .map(|_| FilterType::Group(value.to_string()))?,
Some(("type", value)) => FilterType::BackupType(value.parse()?),
Some(("regex", value)) => FilterType::Regex(Regex::new(value)?),
Some((ty, _value)) => bail!("expected 'group', 'type' or 'regex' prefix, got '{}'", ty),
- None => bail!("input doesn't match expected format '<group:GROUP||type:<vm|ct|host>|regex:REGEX>'"),
+ None => bail!(
+ "input doesn't match expected format '<group:GROUP||type:<vm|ct|host>|regex:REGEX>'"
+ ),
})
}
}
diff --git a/pbs-api-types/src/ldap.rs b/pbs-api-types/src/ldap.rs
index a3e0407b..f40046c5 100644
--- a/pbs-api-types/src/ldap.rs
+++ b/pbs-api-types/src/ldap.rs
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, Updater};
+use proxmox_schema::{ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, Updater, api};
use super::{REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA};
@@ -148,8 +148,7 @@ pub const SYNC_DEFAULTS_STRING_SCHEMA: Schema = StringSchema::new("sync defaults
))
.schema();
-const REMOVE_VANISHED_DESCRIPTION: &str =
- "A semicolon-separated list of things to remove when they or the user \
+const REMOVE_VANISHED_DESCRIPTION: &str = "A semicolon-separated list of things to remove when they or the user \
vanishes during user synchronization. The following values are possible: ``entry`` removes the \
user when not returned from the sync; ``properties`` removes any \
properties on existing user that do not appear in the source. \
diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
index acc2fca3..128345e8 100644
--- a/pbs-api-types/src/lib.rs
+++ b/pbs-api-types/src/lib.rs
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
pub mod percent_encoding;
use proxmox_schema::{
- api, const_regex, ApiStringFormat, ApiType, ArraySchema, ReturnType, Schema, StringSchema,
+ ApiStringFormat, ApiType, ArraySchema, ReturnType, Schema, StringSchema, api, const_regex,
};
use proxmox_time::parse_daily_duration;
@@ -21,7 +21,7 @@ pub use proxmox_schema::api_types::{
pub use proxmox_schema::api_types::{DNS_ALIAS_REGEX, DNS_NAME_OR_IP_REGEX, DNS_NAME_REGEX};
pub use proxmox_schema::api_types::{FINGERPRINT_SHA256_REGEX, SHA256_HEX_REGEX};
pub use proxmox_schema::api_types::{
- GENERIC_URI_REGEX, HOSTNAME_REGEX, HOST_PORT_REGEX, HTTP_URL_REGEX,
+ GENERIC_URI_REGEX, HOST_PORT_REGEX, HOSTNAME_REGEX, HTTP_URL_REGEX,
};
pub use proxmox_schema::api_types::{MULTI_LINE_COMMENT_REGEX, SINGLE_LINE_COMMENT_REGEX};
pub use proxmox_schema::api_types::{PASSWORD_REGEX, SYSTEMD_DATETIME_REGEX, UUID_REGEX};
@@ -29,13 +29,13 @@ pub use proxmox_schema::api_types::{PASSWORD_REGEX, SYSTEMD_DATETIME_REGEX, UUID
pub use proxmox_schema::api_types::{CIDR_FORMAT, CIDR_REGEX};
pub use proxmox_schema::api_types::{CIDR_V4_FORMAT, CIDR_V4_REGEX};
pub use proxmox_schema::api_types::{CIDR_V6_FORMAT, CIDR_V6_REGEX};
-pub use proxmox_schema::api_types::{IPRE_STR, IP_FORMAT, IP_REGEX};
-pub use proxmox_schema::api_types::{IPV4RE_STR, IP_V4_FORMAT, IP_V4_REGEX};
-pub use proxmox_schema::api_types::{IPV6RE_STR, IP_V6_FORMAT, IP_V6_REGEX};
+pub use proxmox_schema::api_types::{IP_FORMAT, IP_REGEX, IPRE_STR};
+pub use proxmox_schema::api_types::{IP_V4_FORMAT, IP_V4_REGEX, IPV4RE_STR};
+pub use proxmox_schema::api_types::{IP_V6_FORMAT, IP_V6_REGEX, IPV6RE_STR};
pub use proxmox_schema::api_types::COMMENT_SCHEMA as SINGLE_LINE_COMMENT_SCHEMA;
-pub use proxmox_schema::api_types::HOSTNAME_SCHEMA;
pub use proxmox_schema::api_types::HOST_PORT_SCHEMA;
+pub use proxmox_schema::api_types::HOSTNAME_SCHEMA;
pub use proxmox_schema::api_types::HTTP_URL_SCHEMA;
pub use proxmox_schema::api_types::MULTI_LINE_COMMENT_SCHEMA;
pub use proxmox_schema::api_types::NODE_SCHEMA;
@@ -113,12 +113,12 @@ pub use node::*;
pub use proxmox_auth_api::types as userid;
pub use proxmox_auth_api::types::{Authid, Userid};
-pub use proxmox_auth_api::types::{Realm, RealmRef};
-pub use proxmox_auth_api::types::{Tokenname, TokennameRef};
-pub use proxmox_auth_api::types::{Username, UsernameRef};
pub use proxmox_auth_api::types::{
PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA,
};
+pub use proxmox_auth_api::types::{Realm, RealmRef};
+pub use proxmox_auth_api::types::{Tokenname, TokennameRef};
+pub use proxmox_auth_api::types::{Username, UsernameRef};
#[macro_use]
mod user;
@@ -127,7 +127,7 @@ pub use user::*;
pub use proxmox_schema::upid::*;
mod crypto;
-pub use crypto::{bytes_as_fingerprint, CryptMode, Fingerprint};
+pub use crypto::{CryptMode, Fingerprint, bytes_as_fingerprint};
pub mod file_restore;
diff --git a/pbs-api-types/src/maintenance.rs b/pbs-api-types/src/maintenance.rs
index 3c9aa819..85a0054e 100644
--- a/pbs-api-types/src/maintenance.rs
+++ b/pbs-api-types/src/maintenance.rs
@@ -1,8 +1,8 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
-use proxmox_schema::{api, const_regex, ApiStringFormat, Schema, StringSchema};
+use proxmox_schema::{ApiStringFormat, Schema, StringSchema, api, const_regex};
const_regex! {
pub MAINTENANCE_MESSAGE_REGEX = r"^[[:^cntrl:]]*$";
diff --git a/pbs-api-types/src/metrics.rs b/pbs-api-types/src/metrics.rs
index ee901276..0eb3c264 100644
--- a/pbs-api-types/src/metrics.rs
+++ b/pbs-api-types/src/metrics.rs
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::{
HOST_PORT_SCHEMA, HTTP_URL_SCHEMA, PROXMOX_SAFE_ID_FORMAT, SINGLE_LINE_COMMENT_SCHEMA,
};
-use proxmox_schema::{api, Schema, StringSchema, Updater};
+use proxmox_schema::{Schema, StringSchema, Updater, api};
pub const METRIC_SERVER_ID_SCHEMA: Schema = StringSchema::new("Metrics Server ID.")
.format(&PROXMOX_SAFE_ID_FORMAT)
diff --git a/pbs-api-types/src/openid.rs b/pbs-api-types/src/openid.rs
index 2c95c5c6..9869d39a 100644
--- a/pbs-api-types/src/openid.rs
+++ b/pbs-api-types/src/openid.rs
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, ApiStringFormat, ArraySchema, Schema, StringSchema, Updater};
+use proxmox_schema::{ApiStringFormat, ArraySchema, Schema, StringSchema, Updater, api};
use super::{
GENERIC_URI_REGEX, PROXMOX_SAFE_ID_FORMAT, PROXMOX_SAFE_ID_REGEX, REALM_ID_SCHEMA,
diff --git a/pbs-api-types/src/pathpatterns.rs b/pbs-api-types/src/pathpatterns.rs
index 505ecc8a..84f193ae 100644
--- a/pbs-api-types/src/pathpatterns.rs
+++ b/pbs-api-types/src/pathpatterns.rs
@@ -1,4 +1,4 @@
-use proxmox_schema::{const_regex, ApiStringFormat, ApiType, Schema, StringSchema};
+use proxmox_schema::{ApiStringFormat, ApiType, Schema, StringSchema, const_regex};
use serde::{Deserialize, Serialize};
diff --git a/pbs-api-types/src/percent_encoding.rs b/pbs-api-types/src/percent_encoding.rs
index afe011e2..6d6dcf80 100644
--- a/pbs-api-types/src/percent_encoding.rs
+++ b/pbs-api-types/src/percent_encoding.rs
@@ -1,4 +1,4 @@
-use percent_encoding::{utf8_percent_encode, AsciiSet};
+use percent_encoding::{AsciiSet, utf8_percent_encode};
/// This used to be: `SIMPLE_ENCODE_SET` plus space, `"`, `#`, `<`, `>`, backtick, `?`, `{`, `}`
pub const DEFAULT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS // 0..1f and 7e
diff --git a/pbs-api-types/src/tape/changer.rs b/pbs-api-types/src/tape/changer.rs
index df3823cf..3bf2b46c 100644
--- a/pbs-api-types/src/tape/changer.rs
+++ b/pbs-api-types/src/tape/changer.rs
@@ -3,7 +3,7 @@
use serde::{Deserialize, Serialize};
use proxmox_schema::{
- api, ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema, Updater,
+ ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema, Updater, api,
};
use crate::{OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT};
diff --git a/pbs-api-types/src/tape/drive.rs b/pbs-api-types/src/tape/drive.rs
index e00665cd..73add439 100644
--- a/pbs-api-types/src/tape/drive.rs
+++ b/pbs-api-types/src/tape/drive.rs
@@ -1,10 +1,10 @@
//! Types for tape drive API
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, IntegerSchema, Schema, StringSchema, Updater};
+use proxmox_schema::{IntegerSchema, Schema, StringSchema, Updater, api};
-use crate::{OptionalDeviceIdentification, CHANGER_NAME_SCHEMA, PROXMOX_SAFE_ID_FORMAT};
+use crate::{CHANGER_NAME_SCHEMA, OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT};
pub const DRIVE_NAME_SCHEMA: Schema = StringSchema::new("Drive Identifier.")
.format(&PROXMOX_SAFE_ID_FORMAT)
diff --git a/pbs-api-types/src/tape/media_location.rs b/pbs-api-types/src/tape/media_location.rs
index 608460b5..03cc876f 100644
--- a/pbs-api-types/src/tape/media_location.rs
+++ b/pbs-api-types/src/tape/media_location.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_schema::{ApiStringFormat, Schema, StringSchema};
diff --git a/pbs-api-types/src/tape/media_pool.rs b/pbs-api-types/src/tape/media_pool.rs
index c3eacec7..46d528f1 100644
--- a/pbs-api-types/src/tape/media_pool.rs
+++ b/pbs-api-types/src/tape/media_pool.rs
@@ -9,7 +9,7 @@ use std::str::FromStr;
use anyhow::Error;
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, ApiStringFormat, Schema, StringSchema, Updater};
+use proxmox_schema::{ApiStringFormat, Schema, StringSchema, Updater, api};
use proxmox_time::{CalendarEvent, TimeSpan};
diff --git a/pbs-api-types/src/tape/mod.rs b/pbs-api-types/src/tape/mod.rs
index 6a9d56bc..0034d65c 100644
--- a/pbs-api-types/src/tape/mod.rs
+++ b/pbs-api-types/src/tape/mod.rs
@@ -25,11 +25,11 @@ pub use media::*;
use const_format::concatcp;
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, const_regex, ApiStringFormat, Schema, StringSchema};
+use proxmox_schema::{ApiStringFormat, Schema, StringSchema, api, const_regex};
use proxmox_uuid::Uuid;
use crate::{
- BackupType, BACKUP_ID_SCHEMA, BACKUP_NS_PATH_RE, FINGERPRINT_SHA256_FORMAT,
+ BACKUP_ID_SCHEMA, BACKUP_NS_PATH_RE, BackupType, FINGERPRINT_SHA256_FORMAT,
PROXMOX_SAFE_ID_REGEX_STR, SNAPSHOT_PATH_REGEX_STR,
};
diff --git a/pbs-api-types/src/traffic_control.rs b/pbs-api-types/src/traffic_control.rs
index c68f4637..94c37e0b 100644
--- a/pbs-api-types/src/traffic_control.rs
+++ b/pbs-api-types/src/traffic_control.rs
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use proxmox_human_byte::HumanByte;
-use proxmox_schema::{api, ApiType, Schema, StringSchema, Updater};
+use proxmox_schema::{ApiType, Schema, StringSchema, Updater, api};
use crate::{
CIDR_SCHEMA, DAILY_DURATION_FORMAT, PROXMOX_SAFE_ID_FORMAT, SINGLE_LINE_COMMENT_SCHEMA,
diff --git a/pbs-api-types/src/user.rs b/pbs-api-types/src/user.rs
index 42f41266..31b698b1 100644
--- a/pbs-api-types/src/user.rs
+++ b/pbs-api-types/src/user.rs
@@ -1,8 +1,8 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, BooleanSchema, IntegerSchema, Schema, StringSchema, Updater};
+use proxmox_schema::{BooleanSchema, IntegerSchema, Schema, StringSchema, Updater, api};
-use super::userid::{Authid, Userid, PROXMOX_TOKEN_ID_SCHEMA};
+use super::userid::{Authid, PROXMOX_TOKEN_ID_SCHEMA, Userid};
use super::{SINGLE_LINE_COMMENT_FORMAT, SINGLE_LINE_COMMENT_SCHEMA};
pub const ENABLE_USER_SCHEMA: Schema = BooleanSchema::new(
diff --git a/pbs-api-types/src/version.rs b/pbs-api-types/src/version.rs
index 09e725eb..aeaa38b9 100644
--- a/pbs-api-types/src/version.rs
+++ b/pbs-api-types/src/version.rs
@@ -2,7 +2,7 @@
use std::cmp::Ordering;
use std::convert::TryFrom;
-use anyhow::{format_err, Context};
+use anyhow::{Context, format_err};
use proxmox_schema::api;
diff --git a/proxmox-access-control/src/acl.rs b/proxmox-access-control/src/acl.rs
index 1964abe2..2e5df932 100644
--- a/proxmox-access-control/src/acl.rs
+++ b/proxmox-access-control/src/acl.rs
@@ -3,11 +3,11 @@ use std::io::Write;
use std::path::Path;
use std::sync::{Arc, OnceLock, RwLock};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_auth_api::types::{Authid, Userid};
use proxmox_config_digest::ConfigDigest;
-use proxmox_product_config::{open_api_lockfile, replace_privileged_config, ApiLockGuard};
+use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_privileged_config};
use crate::init::{access_conf, acl_config, acl_config_lock};
@@ -645,7 +645,7 @@ pub fn save_config(acl: &AclTree) -> Result<(), Error> {
mod test {
use std::{collections::HashMap, sync::OnceLock};
- use crate::init::{init_access_config, AccessControlConfig};
+ use crate::init::{AccessControlConfig, init_access_config};
use super::AclTree;
use anyhow::Error;
@@ -867,9 +867,10 @@ mod test {
);
// user2 has no privileges under "/store/store2/store3" --> return empty
- assert!(tree
- .get_child_paths(&user2, &["store", "store2", "store3"],)?
- .is_empty());
+ assert!(
+ tree.get_child_paths(&user2, &["store", "store2", "store3"],)?
+ .is_empty()
+ );
// user2 has DatastoreReader privileges under "/store/store2/store31" --> return paths
let paths = tree.get_child_paths(&user2, &["store/store2/store31"])?;
@@ -878,15 +879,17 @@ mod test {
);
// user2 has no privileges under "/store/store2/foo/bar/baz"
- assert!(tree
- .get_child_paths(&user2, &["store", "store2", "foo/bar/baz"])?
- .is_empty());
+ assert!(
+ tree.get_child_paths(&user2, &["store", "store2", "foo/bar/baz"])?
+ .is_empty()
+ );
// user2 has DatastoreReader privileges on "/store/store2/store31/store4/store6", but not
// on any child paths --> return empty
- assert!(tree
- .get_child_paths(&user2, &["store/store2/store31/store4/store6"],)?
- .is_empty());
+ assert!(
+ tree.get_child_paths(&user2, &["store/store2/store31/store4/store6"],)?
+ .is_empty()
+ );
Ok(())
}
diff --git a/proxmox-access-control/src/cached_user_info.rs b/proxmox-access-control/src/cached_user_info.rs
index 4d011f00..4c58e468 100644
--- a/proxmox-access-control/src/cached_user_info.rs
+++ b/proxmox-access-control/src/cached_user_info.rs
@@ -2,7 +2,7 @@
use std::sync::{Arc, OnceLock, RwLock};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_auth_api::types::{Authid, Userid};
use proxmox_router::UserInformation;
diff --git a/proxmox-access-control/src/init.rs b/proxmox-access-control/src/init.rs
index b0cf1a3e..a3183ce7 100644
--- a/proxmox-access-control/src/init.rs
+++ b/proxmox-access-control/src/init.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use proxmox_auth_api::types::{Authid, Userid};
use proxmox_section_config::SectionConfigData;
diff --git a/proxmox-access-control/src/token_shadow.rs b/proxmox-access-control/src/token_shadow.rs
index 60b71ac9..bd37376a 100644
--- a/proxmox-access-control/src/token_shadow.rs
+++ b/proxmox-access-control/src/token_shadow.rs
@@ -1,11 +1,11 @@
use std::collections::HashMap;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
-use serde_json::{from_value, Value};
+use serde_json::{Value, from_value};
use proxmox_auth_api::types::Authid;
-use proxmox_product_config::{open_api_lockfile, replace_config, ApiLockGuard};
+use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_config};
use crate::init::{token_shadow, token_shadow_lock};
diff --git a/proxmox-access-control/src/types.rs b/proxmox-access-control/src/types.rs
index ae6de7cf..de11e26b 100644
--- a/proxmox-access-control/src/types.rs
+++ b/proxmox-access-control/src/types.rs
@@ -1,10 +1,9 @@
use serde::{Deserialize, Serialize};
-use proxmox_auth_api::types::{Authid, Userid, PROXMOX_TOKEN_ID_SCHEMA};
+use proxmox_auth_api::types::{Authid, PROXMOX_TOKEN_ID_SCHEMA, Userid};
use proxmox_schema::{
- api,
+ BooleanSchema, IntegerSchema, Schema, StringSchema, Updater, api,
api_types::{COMMENT_SCHEMA, SINGLE_LINE_COMMENT_FORMAT},
- BooleanSchema, IntegerSchema, Schema, StringSchema, Updater,
};
pub const ENABLE_USER_SCHEMA: Schema = BooleanSchema::new(
diff --git a/proxmox-access-control/src/user.rs b/proxmox-access-control/src/user.rs
index 95b70f25..0d60f520 100644
--- a/proxmox-access-control/src/user.rs
+++ b/proxmox-access-control/src/user.rs
@@ -1,11 +1,11 @@
use std::collections::HashMap;
use std::sync::{Arc, OnceLock, RwLock};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_auth_api::types::Authid;
use proxmox_config_digest::ConfigDigest;
-use proxmox_product_config::{open_api_lockfile, replace_privileged_config, ApiLockGuard};
+use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_privileged_config};
use proxmox_schema::*;
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
diff --git a/proxmox-acme-api/src/account_config.rs b/proxmox-acme-api/src/account_config.rs
index 0ced6926..140c1415 100644
--- a/proxmox-acme-api/src/account_config.rs
+++ b/proxmox-acme-api/src/account_config.rs
@@ -5,7 +5,7 @@ use std::ops::ControlFlow;
use std::os::unix::fs::OpenOptionsExt;
use std::path::{Path, PathBuf};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
use proxmox_product_config::replace_secret_config;
@@ -13,9 +13,9 @@ use proxmox_sys::error::SysError;
use proxmox_schema::api_types::SAFE_ID_REGEX;
+use proxmox_acme::Account;
use proxmox_acme::async_client::AcmeClient;
use proxmox_acme::types::AccountData as AcmeAccountData;
-use proxmox_acme::Account;
use crate::acme_account_dir;
use crate::types::AcmeAccountName;
diff --git a/proxmox-acme-api/src/acme_plugin.rs b/proxmox-acme-api/src/acme_plugin.rs
index cd4012f5..a01d5087 100644
--- a/proxmox-acme-api/src/acme_plugin.rs
+++ b/proxmox-acme-api/src/acme_plugin.rs
@@ -6,7 +6,7 @@ use std::process::Stdio;
use std::sync::Arc;
use std::time::Duration;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use hyper::{Body, Request, Response};
use tokio::io::{AsyncBufReadExt, AsyncRead, AsyncWriteExt, BufReader};
use tokio::process::Command;
diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs
index a0d744c8..854e98e6 100644
--- a/proxmox-acme-api/src/certificate_helpers.rs
+++ b/proxmox-acme-api/src/certificate_helpers.rs
@@ -4,17 +4,17 @@ use std::time::Duration;
use foreign_types::ForeignTypeRef;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use openssl::pkey::{PKey, Private};
use openssl::rsa::Rsa;
-use openssl::x509::{X509Builder, X509};
+use openssl::x509::{X509, X509Builder};
use proxmox_acme::async_client::AcmeClient;
use proxmox_log::{info, warn};
use proxmox_rest_server::WorkerTask;
-use crate::types::{AcmeConfig, AcmeDomain};
use crate::CertificateInfo;
+use crate::types::{AcmeConfig, AcmeDomain};
pub async fn revoke_certificate(acme_config: &AcmeConfig, certificate: &[u8]) -> Result<(), Error> {
let mut acme = super::account_config::load_account_config(&acme_config.account)
diff --git a/proxmox-acme-api/src/lib.rs b/proxmox-acme-api/src/lib.rs
index 623e9e23..196269b6 100644
--- a/proxmox-acme-api/src/lib.rs
+++ b/proxmox-acme-api/src/lib.rs
@@ -17,7 +17,7 @@ pub use config::{DEFAULT_ACME_DIRECTORY_ENTRY, KNOWN_ACME_DIRECTORIES};
#[cfg(feature = "impl")]
mod challenge_schemas;
#[cfg(feature = "impl")]
-pub use challenge_schemas::{get_cached_challenge_schemas, ChallengeSchemaWrapper};
+pub use challenge_schemas::{ChallengeSchemaWrapper, get_cached_challenge_schemas};
#[cfg(feature = "impl")]
mod account_config;
diff --git a/proxmox-acme-api/src/plugin_api_impl.rs b/proxmox-acme-api/src/plugin_api_impl.rs
index 6c2403e4..a367e535 100644
--- a/proxmox-acme-api/src/plugin_api_impl.rs
+++ b/proxmox-acme-api/src/plugin_api_impl.rs
@@ -1,6 +1,6 @@
//! ACME plugin configuration API implementation
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::Deserialize;
use serde_json::Value;
@@ -12,7 +12,7 @@ use crate::types::{
DeletablePluginProperty, DnsPlugin, DnsPluginCore, DnsPluginCoreUpdater, PluginConfig,
};
-use proxmox_router::{http_bail, RpcEnvironment};
+use proxmox_router::{RpcEnvironment, http_bail};
pub fn list_plugins(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<PluginConfig>, Error> {
let (plugins, digest) = super::plugin_config::plugin_config()?;
diff --git a/proxmox-acme-api/src/plugin_config.rs b/proxmox-acme-api/src/plugin_config.rs
index b7ed7594..e61b3f72 100644
--- a/proxmox-acme-api/src/plugin_config.rs
+++ b/proxmox-acme-api/src/plugin_config.rs
@@ -6,11 +6,11 @@ use anyhow::Error;
use serde_json::Value;
use proxmox_config_digest::ConfigDigest;
-use proxmox_product_config::{open_api_lockfile, replace_secret_config, ApiLockGuard};
+use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_secret_config};
use proxmox_schema::{ApiType, Schema};
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
-use crate::types::{DnsPlugin, StandalonePlugin, PLUGIN_ID_SCHEMA};
+use crate::types::{DnsPlugin, PLUGIN_ID_SCHEMA, StandalonePlugin};
static CONFIG: LazyLock<SectionConfig> = LazyLock::new(init);
diff --git a/proxmox-acme-api/src/types.rs b/proxmox-acme-api/src/types.rs
index d46497ca..934e6ece 100644
--- a/proxmox-acme-api/src/types.rs
+++ b/proxmox-acme-api/src/types.rs
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
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_schema::{ApiStringFormat, ApiType, Schema, StringSchema, Updater, api};
use proxmox_acme::types::AccountData as AcmeAccountData;
diff --git a/proxmox-acme/src/account.rs b/proxmox-acme/src/account.rs
index 6993b2cf..3e5a3ec3 100644
--- a/proxmox-acme/src/account.rs
+++ b/proxmox-acme/src/account.rs
@@ -8,6 +8,7 @@ use openssl::pkey::{PKey, Private};
use serde::{Deserialize, Serialize};
use serde_json::Value;
+use crate::Error;
use crate::authorization::{Authorization, GetAuthorization};
use crate::b64u;
use crate::directory::Directory;
@@ -16,7 +17,6 @@ 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/async_client.rs b/proxmox-acme/src/async_client.rs
index ce5a6c79..dec10842 100644
--- a/proxmox-acme/src/async_client.rs
+++ b/proxmox-acme/src/async_client.rs
@@ -7,9 +7,9 @@ use serde::{Deserialize, Serialize};
use proxmox_http::client::Client;
+use crate::Request as AcmeRequest;
use crate::account::AccountCreator;
use crate::order::{Order, OrderData};
-use crate::Request as AcmeRequest;
use crate::{Account, Authorization, Challenge, Directory, Error, ErrorResponse};
/// A non-blocking Acme client using tokio/hyper.
diff --git a/proxmox-acme/src/authorization.rs b/proxmox-acme/src/authorization.rs
index 28bc1b4b..a4a1f019 100644
--- a/proxmox-acme/src/authorization.rs
+++ b/proxmox-acme/src/authorization.rs
@@ -5,9 +5,9 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_json::Value;
+use crate::Error;
use crate::order::Identifier;
use crate::request::Request;
-use crate::Error;
/// Status of an [`Authorization`].
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
diff --git a/proxmox-acme/src/eab.rs b/proxmox-acme/src/eab.rs
index 3e0d2816..7052a54f 100644
--- a/proxmox-acme/src/eab.rs
+++ b/proxmox-acme/src/eab.rs
@@ -6,7 +6,7 @@ use serde::Serialize;
use crate::key::Jwk;
use crate::types::ExternalAccountBinding;
-use crate::{b64u, Error};
+use crate::{Error, b64u};
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
diff --git a/proxmox-acme/src/jws.rs b/proxmox-acme/src/jws.rs
index b867f714..350cd451 100644
--- a/proxmox-acme/src/jws.rs
+++ b/proxmox-acme/src/jws.rs
@@ -5,9 +5,9 @@ use openssl::pkey::{HasPrivate, PKeyRef};
use openssl::sign::Signer;
use serde::Serialize;
+use crate::Error;
use crate::b64u;
use crate::key::{Jwk, PublicKey};
-use crate::Error;
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
diff --git a/proxmox-acme/src/key.rs b/proxmox-acme/src/key.rs
index 5dbc5460..ae790d04 100644
--- a/proxmox-acme/src/key.rs
+++ b/proxmox-acme/src/key.rs
@@ -4,8 +4,8 @@ use openssl::hash::{Hasher, MessageDigest};
use openssl::pkey::{HasPublic, Id, PKeyRef};
use serde::Serialize;
-use crate::b64u;
use crate::Error;
+use crate::b64u;
/// An RSA public key.
#[derive(Clone, Debug, Serialize)]
diff --git a/proxmox-acme/src/order.rs b/proxmox-acme/src/order.rs
index b6551004..d75fbde1 100644
--- a/proxmox-acme/src/order.rs
+++ b/proxmox-acme/src/order.rs
@@ -3,8 +3,8 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
-use crate::request::Request;
use crate::Error;
+use crate::request::Request;
/// Status of an [`Order`].
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
diff --git a/proxmox-api-macro/src/api/enums.rs b/proxmox-api-macro/src/api/enums.rs
index 9b122f9c..f3de7929 100644
--- a/proxmox-api-macro/src/api/enums.rs
+++ b/proxmox-api-macro/src/api/enums.rs
@@ -6,8 +6,8 @@ use proc_macro2::{Ident, Span, TokenStream};
use quote::quote_spanned;
use syn::spanned::Spanned;
-use super::attributes::EnumFieldAttributes;
use super::Schema;
+use super::attributes::EnumFieldAttributes;
use crate::serde;
use crate::util::{self, FieldName, JSONObject, JSONValue, Maybe};
diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index cca07145..0804b67d 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -11,11 +11,11 @@ use std::mem;
use anyhow::Error;
use proc_macro2::{Span, TokenStream};
-use quote::{quote, quote_spanned, ToTokens};
+use quote::{ToTokens, quote, quote_spanned};
+use syn::Ident;
use syn::ext::IdentExt;
use syn::spanned::Spanned;
use syn::visit_mut::{self, VisitMut};
-use syn::Ident;
use super::{ObjectEntry, Schema, SchemaItem, SchemaObject};
use crate::util::{self, FieldName, JSONObject, JSONValue, Maybe};
@@ -93,11 +93,7 @@ impl TryFrom<JSONObject> for ReturnSchema {
Some(value) => {
let span = value.span();
let is_optional: bool = value.try_into()?;
- if is_optional {
- Some(span)
- } else {
- None
- }
+ if is_optional { Some(span) } else { None }
}
None => None,
};
@@ -523,7 +519,7 @@ fn is_value_type(ty: &syn::Type) -> bool {
1 => return segs.last().unwrap().ident == "Value",
2 => {
return segs.first().unwrap().ident == "serde_json"
- && segs.last().unwrap().ident == "Value"
+ && segs.last().unwrap().ident == "Value";
}
_ => return false,
}
diff --git a/proxmox-api-macro/src/api/mod.rs b/proxmox-api-macro/src/api/mod.rs
index 416ea56e..8078db07 100644
--- a/proxmox-api-macro/src/api/mod.rs
+++ b/proxmox-api-macro/src/api/mod.rs
@@ -12,7 +12,7 @@ use std::convert::{TryFrom, TryInto};
use anyhow::Error;
use proc_macro2::{Span, TokenStream};
-use quote::{quote, quote_spanned, ToTokens};
+use quote::{ToTokens, quote, quote_spanned};
use syn::parse::{Parse, ParseStream, Parser};
use syn::spanned::Spanned;
use syn::{Expr, ExprPath, Ident};
diff --git a/proxmox-api-macro/src/api/structs.rs b/proxmox-api-macro/src/api/structs.rs
index c18b20b4..e11c68ad 100644
--- a/proxmox-api-macro/src/api/structs.rs
+++ b/proxmox-api-macro/src/api/structs.rs
@@ -18,8 +18,8 @@ use anyhow::Error;
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote_spanned;
-use super::attributes::UpdaterFieldAttributes;
use super::Schema;
+use super::attributes::UpdaterFieldAttributes;
use crate::api::{self, ObjectEntry, SchemaItem};
use crate::serde;
use crate::util::{self, FieldName, JSONObject, Maybe};
diff --git a/proxmox-api-macro/src/serde.rs b/proxmox-api-macro/src/serde.rs
index 62430f16..9993f9e5 100644
--- a/proxmox-api-macro/src/serde.rs
+++ b/proxmox-api-macro/src/serde.rs
@@ -6,9 +6,9 @@
use std::convert::TryFrom;
use proc_macro2::Span;
+use syn::Token;
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
-use syn::Token;
/// Serde name types.
#[allow(clippy::enum_variant_names)]
diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs
index 11a83e46..003f5c3b 100644
--- a/proxmox-api-macro/src/util.rs
+++ b/proxmox-api-macro/src/util.rs
@@ -4,10 +4,10 @@ use std::convert::TryFrom;
use proc_macro2::{Ident, Span, TokenStream, TokenTree};
use quote::ToTokens;
+use syn::Token;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
-use syn::Token;
use anyhow::Error;
diff --git a/proxmox-api-macro/tests/allof.rs b/proxmox-api-macro/tests/allof.rs
index 57089d26..eaaf5606 100644
--- a/proxmox-api-macro/tests/allof.rs
+++ b/proxmox-api-macro/tests/allof.rs
@@ -2,7 +2,7 @@
use anyhow::Error;
use serde::{Deserialize, Serialize};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use proxmox_api_macro::api;
use proxmox_schema as schema;
diff --git a/proxmox-api-macro/tests/api1.rs b/proxmox-api-macro/tests/api1.rs
index cff0cd5b..125733fb 100644
--- a/proxmox-api-macro/tests/api1.rs
+++ b/proxmox-api-macro/tests/api1.rs
@@ -1,7 +1,7 @@
use proxmox_api_macro::api;
use anyhow::Error;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use proxmox_router::Permission;
diff --git a/proxmox-api-macro/tests/ext-schema.rs b/proxmox-api-macro/tests/ext-schema.rs
index 4c88de0e..3e2d1cdf 100644
--- a/proxmox-api-macro/tests/ext-schema.rs
+++ b/proxmox-api-macro/tests/ext-schema.rs
@@ -6,7 +6,7 @@ use proxmox_router::RpcEnvironment;
use proxmox_schema as schema;
use anyhow::Error;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
pub const NAME_SCHEMA: schema::Schema = schema::StringSchema::new("Archive name.")
//.format(&FILENAME_FORMAT)
diff --git a/proxmox-api-macro/tests/options.rs b/proxmox-api-macro/tests/options.rs
index 6a7fa1ba..6d61cc10 100644
--- a/proxmox-api-macro/tests/options.rs
+++ b/proxmox-api-macro/tests/options.rs
@@ -1,7 +1,7 @@
use proxmox_api_macro::api;
use anyhow::Error;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
#[api(
input: {
diff --git a/proxmox-api-macro/tests/updater.rs b/proxmox-api-macro/tests/updater.rs
index 43f97da2..b04abedf 100644
--- a/proxmox-api-macro/tests/updater.rs
+++ b/proxmox-api-macro/tests/updater.rs
@@ -2,7 +2,7 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::{api, ApiType, Updater, UpdaterType};
+use proxmox_schema::{ApiType, Updater, UpdaterType, api};
// Helpers for type checks:
struct AssertTypeEq<T>(T);
diff --git a/proxmox-apt/src/api.rs b/proxmox-apt/src/api.rs
index 14dfb53b..42c609ee 100644
--- a/proxmox-apt/src/api.rs
+++ b/proxmox-apt/src/api.rs
@@ -1,7 +1,7 @@
// API function that work without feature "cache"
use std::path::Path;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_apt_api_types::{
APTChangeRepositoryOptions, APTGetChangelogOptions, APTRepositoriesResult, APTRepositoryFile,
diff --git a/proxmox-apt/src/cache.rs b/proxmox-apt/src/cache.rs
index 03315013..1c04481f 100644
--- a/proxmox-apt/src/cache.rs
+++ b/proxmox-apt/src/cache.rs
@@ -2,11 +2,11 @@ use std::collections::HashMap;
use std::collections::HashSet;
use std::path::Path;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use apt_pkg_native::Cache;
use proxmox_schema::const_regex;
-use proxmox_sys::fs::{file_read_optional_string, replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, file_read_optional_string, replace_file};
use proxmox_apt_api_types::APTUpdateInfo;
diff --git a/proxmox-apt/src/cache_api.rs b/proxmox-apt/src/cache_api.rs
index a2cd67f8..205f30e9 100644
--- a/proxmox-apt/src/cache_api.rs
+++ b/proxmox-apt/src/cache_api.rs
@@ -1,7 +1,7 @@
// API function that need feature "cache"
use std::path::Path;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use std::os::unix::prelude::OsStrExt;
use proxmox_apt_api_types::{APTUpdateInfo, APTUpdateOptions};
diff --git a/proxmox-apt/src/deb822/mod.rs b/proxmox-apt/src/deb822/mod.rs
index 59e7c210..d13c8670 100644
--- a/proxmox-apt/src/deb822/mod.rs
+++ b/proxmox-apt/src/deb822/mod.rs
@@ -1,5 +1,5 @@
mod release_file;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
pub use release_file::{CompressionType, FileReference, FileReferenceType, ReleaseFile};
mod packages_file;
diff --git a/proxmox-apt/src/deb822/packages_file.rs b/proxmox-apt/src/deb822/packages_file.rs
index aec0a926..7f691ebb 100644
--- a/proxmox-apt/src/deb822/packages_file.rs
+++ b/proxmox-apt/src/deb822/packages_file.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use rfc822_like::de::Deserializer;
use serde::Deserialize;
use serde_json::Value;
diff --git a/proxmox-apt/src/deb822/release_file.rs b/proxmox-apt/src/deb822/release_file.rs
index dbf1a367..68a626fb 100644
--- a/proxmox-apt/src/deb822/release_file.rs
+++ b/proxmox-apt/src/deb822/release_file.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use rfc822_like::de::Deserializer;
use serde::Deserialize;
use serde_json::Value;
diff --git a/proxmox-apt/src/deb822/sources_file.rs b/proxmox-apt/src/deb822/sources_file.rs
index 40bef6e0..3893350e 100644
--- a/proxmox-apt/src/deb822/sources_file.rs
+++ b/proxmox-apt/src/deb822/sources_file.rs
@@ -1,6 +1,6 @@
use std::collections::HashMap;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use rfc822_like::de::Deserializer;
use serde::Deserialize;
use serde_json::Value;
diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
index e34e84e0..debf0f40 100644
--- a/proxmox-apt/src/repositories/file.rs
+++ b/proxmox-apt/src/repositories/file.rs
@@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use crate::repositories::release::DebianCodename;
use proxmox_apt_api_types::{
diff --git a/proxmox-apt/src/repositories/file/list_parser.rs b/proxmox-apt/src/repositories/file/list_parser.rs
index 8681509a..3e143ade 100644
--- a/proxmox-apt/src/repositories/file/list_parser.rs
+++ b/proxmox-apt/src/repositories/file/list_parser.rs
@@ -1,7 +1,7 @@
use std::io::BufRead;
use std::iter::Iterator;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use super::APTRepositoryParser;
use crate::repositories::APTRepositoryImpl;
diff --git a/proxmox-apt/src/repositories/file/sources_parser.rs b/proxmox-apt/src/repositories/file/sources_parser.rs
index c85b8d2e..bc6a616f 100644
--- a/proxmox-apt/src/repositories/file/sources_parser.rs
+++ b/proxmox-apt/src/repositories/file/sources_parser.rs
@@ -1,7 +1,7 @@
use std::io::BufRead;
use std::iter::Iterator;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use crate::repositories::APTRepositoryImpl;
use crate::repositories::{
diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
index 5665de40..69b0ffa9 100644
--- a/proxmox-apt/src/repositories/mod.rs
+++ b/proxmox-apt/src/repositories/mod.rs
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
mod repository;
use proxmox_apt_api_types::{
@@ -16,7 +16,7 @@ mod file;
pub use file::APTRepositoryFileImpl;
mod release;
-pub use release::{get_current_release_codename, DebianCodename};
+pub use release::{DebianCodename, get_current_release_codename};
mod standard;
pub use standard::{APTRepositoryHandleImpl, APTStandardRepositoryImpl};
diff --git a/proxmox-apt/src/repositories/release.rs b/proxmox-apt/src/repositories/release.rs
index da391e58..9a4fabba 100644
--- a/proxmox-apt/src/repositories/release.rs
+++ b/proxmox-apt/src/repositories/release.rs
@@ -1,7 +1,7 @@
use std::fmt::Display;
use std::io::{BufRead, BufReader};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
/// The code names of Debian releases. Does not include `sid`.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
diff --git a/proxmox-apt/src/repositories/repository.rs b/proxmox-apt/src/repositories/repository.rs
index 62ad49d8..548ca103 100644
--- a/proxmox-apt/src/repositories/repository.rs
+++ b/proxmox-apt/src/repositories/repository.rs
@@ -1,7 +1,7 @@
use std::io::{BufRead, BufReader, Write};
use std::path::{Path, PathBuf};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use crate::repositories::standard::APTRepositoryHandleImpl;
use proxmox_apt_api_types::{
diff --git a/proxmox-apt/tests/repositories.rs b/proxmox-apt/tests/repositories.rs
index 61d770b3..01b21da3 100644
--- a/proxmox-apt/tests/repositories.rs
+++ b/proxmox-apt/tests/repositories.rs
@@ -1,12 +1,12 @@
use std::path::PathBuf;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use proxmox_apt::repositories::{
- check_repositories, get_current_release_codename, standard_repositories, DebianCodename,
+ APTRepositoryFileImpl, APTRepositoryImpl, APTStandardRepositoryImpl,
};
use proxmox_apt::repositories::{
- APTRepositoryFileImpl, APTRepositoryImpl, APTStandardRepositoryImpl,
+ DebianCodename, check_repositories, get_current_release_codename, standard_repositories,
};
use proxmox_apt_api_types::{
APTRepositoryFile, APTRepositoryHandle, APTRepositoryInfo, APTStandardRepository,
diff --git a/proxmox-async/src/broadcast_future.rs b/proxmox-async/src/broadcast_future.rs
index 62982e13..c71880f6 100644
--- a/proxmox-async/src/broadcast_future.rs
+++ b/proxmox-async/src/broadcast_future.rs
@@ -4,7 +4,7 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use futures::future::{FutureExt, TryFutureExt};
use tokio::sync::oneshot;
@@ -44,7 +44,7 @@ impl<T: Clone> BroadcastData<T> {
}
pub fn listen(&mut self) -> impl Future<Output = Result<T, Error>> + use<T> {
- use futures::future::{ok, Either};
+ use futures::future::{Either, ok};
match &self.result {
None => {}
diff --git a/proxmox-auth-api/examples/passwd.rs b/proxmox-auth-api/examples/passwd.rs
index 27816271..58397b28 100644
--- a/proxmox-auth-api/examples/passwd.rs
+++ b/proxmox-auth-api/examples/passwd.rs
@@ -5,7 +5,7 @@ use std::io::Write;
use std::pin::Pin;
use std::task::{Context, Poll};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use proxmox_auth_api::api::Authenticator;
use proxmox_auth_api::types::Username;
diff --git a/proxmox-auth-api/src/api/access.rs b/proxmox-auth-api/src/api/access.rs
index f7d52e95..3ac2fd46 100644
--- a/proxmox-auth-api/src/api/access.rs
+++ b/proxmox-auth-api/src/api/access.rs
@@ -1,16 +1,16 @@
//! Provides the "/access/ticket" API call.
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use openssl::hash::MessageDigest;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use proxmox_rest_server::RestEnvironment;
-use proxmox_router::{http_err, Permission, RpcEnvironment};
+use proxmox_router::{Permission, RpcEnvironment, http_err};
use proxmox_schema::{api, api_types::PASSWORD_SCHEMA};
use proxmox_tfa::api::TfaChallenge;
use super::ApiTicket;
-use super::{auth_context, HMACKey};
+use super::{HMACKey, auth_context};
use crate::ticket::Ticket;
use crate::types::{Authid, Userid};
diff --git a/proxmox-auth-api/src/api/mod.rs b/proxmox-auth-api/src/api/mod.rs
index a6f9d425..3a425d63 100644
--- a/proxmox-auth-api/src/api/mod.rs
+++ b/proxmox-auth-api/src/api/mod.rs
@@ -3,10 +3,10 @@ use std::net::IpAddr;
use std::pin::Pin;
use std::sync::Mutex;
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use percent_encoding::percent_decode_str;
-use proxmox_rest_server::{extract_cookie, AuthError};
+use proxmox_rest_server::{AuthError, extract_cookie};
use proxmox_tfa::api::{OpenUserChallengeData, TfaConfig};
use crate::auth_key::{HMACKey, Keyring};
@@ -18,7 +18,7 @@ mod ticket;
use crate::ticket::Ticket;
use access::verify_csrf_prevention_token;
-pub use access::{assemble_csrf_prevention_token, create_ticket, API_METHOD_CREATE_TICKET};
+pub use access::{API_METHOD_CREATE_TICKET, assemble_csrf_prevention_token, create_ticket};
pub use ticket::{ApiTicket, PartialTicket};
/// Authentication realms are used to manage users: authenticate, change password or remove.
diff --git a/proxmox-auth-api/src/api/ticket.rs b/proxmox-auth-api/src/api/ticket.rs
index f2d1580b..bf959c7e 100644
--- a/proxmox-auth-api/src/api/ticket.rs
+++ b/proxmox-auth-api/src/api/ticket.rs
@@ -2,7 +2,7 @@
use std::fmt;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
use proxmox_tfa::api::TfaChallenge;
diff --git a/proxmox-auth-api/src/auth_key.rs b/proxmox-auth-api/src/auth_key.rs
index 9873d935..98684853 100644
--- a/proxmox-auth-api/src/auth_key.rs
+++ b/proxmox-auth-api/src/auth_key.rs
@@ -1,6 +1,6 @@
//! Auth key handling.
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use openssl::hash::MessageDigest;
use openssl::pkey::{HasPublic, Id, PKey, PKeyRef, Private, Public};
use openssl::rsa::Rsa;
@@ -314,7 +314,7 @@ impl Keyring {
if let Some(key) = &self.signing_key {
match key {
SigningKey::Private(key) if verify_with(&key.key, digest, signature, data)? => {
- return Ok(true)
+ return Ok(true);
}
SigningKey::Hmac(key) if key.verify(digest, signature, data)? => return Ok(true),
_ => (),
@@ -324,10 +324,10 @@ impl Keyring {
for key in &self.public_keys {
match key {
VerificationKey::Public(key) if verify_with(&key.key, digest, signature, data)? => {
- return Ok(true)
+ return Ok(true);
}
VerificationKey::Hmac(key) if key.verify(digest, signature, data)? => {
- return Ok(true)
+ return Ok(true);
}
_ => (),
}
diff --git a/proxmox-auth-api/src/pam_authenticator.rs b/proxmox-auth-api/src/pam_authenticator.rs
index d34575be..a2a1b1ad 100644
--- a/proxmox-auth-api/src/pam_authenticator.rs
+++ b/proxmox-auth-api/src/pam_authenticator.rs
@@ -1,9 +1,9 @@
-use std::ffi::{c_int, c_void, CStr, CString};
+use std::ffi::{CStr, CString, c_int, c_void};
use std::future::Future;
use std::net::IpAddr;
use std::pin::Pin;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use pam_sys::types::{
PamHandle, PamItemType, PamMessage, PamMessageStyle, PamResponse, PamReturnCode,
};
diff --git a/proxmox-auth-api/src/password_authenticator.rs b/proxmox-auth-api/src/password_authenticator.rs
index 06b6551a..6a946bb0 100644
--- a/proxmox-auth-api/src/password_authenticator.rs
+++ b/proxmox-auth-api/src/password_authenticator.rs
@@ -2,7 +2,7 @@ use std::future::Future;
use std::net::IpAddr;
use std::pin::Pin;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde_json::json;
use proxmox_product_config::open_secret_lockfile;
diff --git a/proxmox-auth-api/src/ticket.rs b/proxmox-auth-api/src/ticket.rs
index 498e9385..12f81145 100644
--- a/proxmox-auth-api/src/ticket.rs
+++ b/proxmox-auth-api/src/ticket.rs
@@ -3,9 +3,9 @@
use std::borrow::Cow;
use std::marker::PhantomData;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use openssl::hash::MessageDigest;
-use percent_encoding::{percent_decode_str, percent_encode, AsciiSet};
+use percent_encoding::{AsciiSet, percent_decode_str, percent_encode};
use crate::auth_key::Keyring;
diff --git a/proxmox-auth-api/src/types.rs b/proxmox-auth-api/src/types.rs
index 64c580a5..79989941 100644
--- a/proxmox-auth-api/src/types.rs
+++ b/proxmox-auth-api/src/types.rs
@@ -25,12 +25,12 @@ use std::borrow::Borrow;
use std::fmt;
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use const_format::concatcp;
use serde::{Deserialize, Serialize};
use proxmox_schema::{
- api, const_regex, ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType,
+ ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType, api, const_regex,
};
use proxmox_schema::api_types::SAFE_ID_REGEX_STR;
diff --git a/proxmox-client/src/client.rs b/proxmox-client/src/client.rs
index 9b078a98..a3edb840 100644
--- a/proxmox-client/src/client.rs
+++ b/proxmox-client/src/client.rs
@@ -4,9 +4,9 @@ use std::pin::Pin;
use std::sync::Arc;
use std::sync::Mutex;
+use http::Method;
use http::request::Request;
use http::uri::PathAndQuery;
-use http::Method;
use http::{StatusCode, Uri};
use hyper::body::{Body, HttpBody};
use openssl::hash::MessageDigest;
diff --git a/proxmox-compression/src/zip.rs b/proxmox-compression/src/zip.rs
index 3ccece9b..d074be5a 100644
--- a/proxmox-compression/src/zip.rs
+++ b/proxmox-compression/src/zip.rs
@@ -14,7 +14,7 @@ use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::SystemTime;
-use anyhow::{format_err, Error, Result};
+use anyhow::{Error, Result, format_err};
use endian_trait::Endian;
use futures::ready;
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf};
diff --git a/proxmox-compression/src/zstd.rs b/proxmox-compression/src/zstd.rs
index 7e303833..471d65ec 100644
--- a/proxmox-compression/src/zstd.rs
+++ b/proxmox-compression/src/zstd.rs
@@ -3,7 +3,7 @@ use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use bytes::Bytes;
use futures::ready;
use futures::stream::Stream;
diff --git a/proxmox-config-digest/src/lib.rs b/proxmox-config-digest/src/lib.rs
index a34a3a90..85827f36 100644
--- a/proxmox-config-digest/src/lib.rs
+++ b/proxmox-config-digest/src/lib.rs
@@ -1,15 +1,15 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
#[cfg(feature = "openssl")]
use openssl::sha;
-use proxmox_schema::api_types::SHA256_HEX_REGEX;
use proxmox_schema::ApiStringFormat;
use proxmox_schema::ApiType;
use proxmox_schema::Schema;
use proxmox_schema::StringSchema;
+use proxmox_schema::api_types::SHA256_HEX_REGEX;
pub const PROXMOX_CONFIG_DIGEST_FORMAT: ApiStringFormat =
ApiStringFormat::Pattern(&SHA256_HEX_REGEX);
diff --git a/proxmox-daemon/src/command_socket.rs b/proxmox-daemon/src/command_socket.rs
index b268bded..49d640bc 100644
--- a/proxmox-daemon/src/command_socket.rs
+++ b/proxmox-daemon/src/command_socket.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use std::collections::HashMap;
use std::future::Future;
diff --git a/proxmox-daemon/src/server.rs b/proxmox-daemon/src/server.rs
index 670e3c3b..de070404 100644
--- a/proxmox-daemon/src/server.rs
+++ b/proxmox-daemon/src/server.rs
@@ -7,11 +7,11 @@ use std::os::unix::ffi::OsStrExt;
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
use std::panic::UnwindSafe;
use std::path::PathBuf;
-use std::pin::{pin, Pin};
+use std::pin::{Pin, pin};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use futures::future::{self, Either};
-use nix::unistd::{fork, ForkResult};
+use nix::unistd::{ForkResult, fork};
use proxmox_sys::fd::fd_change_cloexec;
use proxmox_sys::fs::CreateOptions;
diff --git a/proxmox-daemon/src/state.rs b/proxmox-daemon/src/state.rs
index f5d23bcf..e1bde586 100644
--- a/proxmox-daemon/src/state.rs
+++ b/proxmox-daemon/src/state.rs
@@ -1,10 +1,10 @@
use std::future::Future;
use std::pin::pin;
-use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::OnceLock;
+use std::sync::atomic::{AtomicBool, Ordering};
-use anyhow::{bail, Error};
-use tokio::signal::unix::{signal, SignalKind};
+use anyhow::{Error, bail};
+use tokio::signal::unix::{SignalKind, signal};
use tokio::sync::watch;
static SHUTDOWN_LISTENERS: OnceLock<watch::Sender<bool>> = OnceLock::new();
diff --git a/proxmox-dns-api/src/api_types.rs b/proxmox-dns-api/src/api_types.rs
index f0ff70f4..20d8bdf9 100644
--- a/proxmox-dns-api/src/api_types.rs
+++ b/proxmox-dns-api/src/api_types.rs
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
-use proxmox_schema::api;
-use proxmox_schema::api_types::IP_FORMAT;
use proxmox_schema::Schema;
use proxmox_schema::StringSchema;
+use proxmox_schema::api;
+use proxmox_schema::api_types::IP_FORMAT;
use proxmox_config_digest::ConfigDigest;
diff --git a/proxmox-dns-api/src/resolv_conf.rs b/proxmox-dns-api/src/resolv_conf.rs
index 32698913..03a91ee0 100644
--- a/proxmox-dns-api/src/resolv_conf.rs
+++ b/proxmox-dns-api/src/resolv_conf.rs
@@ -5,9 +5,9 @@ use const_format::concatcp;
use proxmox_config_digest::ConfigDigest;
use regex::Regex;
+use proxmox_sys::fs::CreateOptions;
use proxmox_sys::fs::file_get_contents;
use proxmox_sys::fs::replace_file;
-use proxmox_sys::fs::CreateOptions;
use proxmox_schema::api_types::IPRE_STR;
diff --git a/proxmox-http-error/src/lib.rs b/proxmox-http-error/src/lib.rs
index a8ccff7f..ea404845 100644
--- a/proxmox-http-error/src/lib.rs
+++ b/proxmox-http-error/src/lib.rs
@@ -2,7 +2,7 @@
use std::fmt;
-use serde::{ser::SerializeStruct, Serialize, Serializer};
+use serde::{Serialize, Serializer, ser::SerializeStruct};
#[doc(hidden)]
pub use http::StatusCode;
diff --git a/proxmox-http/src/client/connector.rs b/proxmox-http/src/client/connector.rs
index 63b9d10c..b803af76 100644
--- a/proxmox-http/src/client/connector.rs
+++ b/proxmox-http/src/client/connector.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use std::os::unix::io::AsRawFd;
use std::pin::Pin;
use std::sync::Arc;
diff --git a/proxmox-http/src/client/simple.rs b/proxmox-http/src/client/simple.rs
index 062889ac..ae1d4f06 100644
--- a/proxmox-http/src/client/simple.rs
+++ b/proxmox-http/src/client/simple.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use std::collections::HashMap;
#[cfg(all(feature = "client-trait", feature = "proxmox-async"))]
@@ -8,13 +8,13 @@ use futures::*;
#[cfg(all(feature = "client-trait", feature = "proxmox-async"))]
use http::header::HeaderName;
use http::{HeaderValue, Request, Response};
+use hyper::Body;
use hyper::client::Client as HyperClient;
use hyper::client::HttpConnector;
-use hyper::Body;
use openssl::ssl::{SslConnector, SslMethod};
-use crate::client::HttpsConnector;
use crate::HttpOptions;
+use crate::client::HttpsConnector;
/// Asynchronous HTTP client implementation
pub struct Client {
@@ -299,8 +299,8 @@ si aliquod aeternum et infinitum impendere."#;
}
fn encode_deflate(bytes: &[u8]) -> Result<Vec<u8>, std::io::Error> {
- use flate2::write::ZlibEncoder;
use flate2::Compression;
+ use flate2::write::ZlibEncoder;
let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
e.write_all(bytes).unwrap();
diff --git a/proxmox-http/src/proxy_config.rs b/proxmox-http/src/proxy_config.rs
index 0861d8f7..dd8bc63f 100644
--- a/proxmox-http/src/proxy_config.rs
+++ b/proxmox-http/src/proxy_config.rs
@@ -2,7 +2,7 @@
//!
//! This can be used with the async [`Client`](crate::client::Client) or sync [`Client`](crate::client::sync::Client).
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use http::Uri;
diff --git a/proxmox-http/src/rate_limiter.rs b/proxmox-http/src/rate_limiter.rs
index 945c77a6..246d73c0 100644
--- a/proxmox-http/src/rate_limiter.rs
+++ b/proxmox-http/src/rate_limiter.rs
@@ -1,7 +1,7 @@
use std::convert::TryInto;
use std::time::{Duration, Instant};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
/// Rate limiter interface.
pub trait RateLimit {
diff --git a/proxmox-http/src/uri.rs b/proxmox-http/src/uri.rs
index ecea1bca..0cf75cb6 100644
--- a/proxmox-http/src/uri.rs
+++ b/proxmox-http/src/uri.rs
@@ -1,8 +1,8 @@
//! URI Related helpers, such as `build_authority`
+use anyhow::Error;
use anyhow::bail;
use anyhow::format_err;
-use anyhow::Error;
use http::uri::{Authority, InvalidUri};
use serde_json::Value;
diff --git a/proxmox-http/src/websocket/mod.rs b/proxmox-http/src/websocket/mod.rs
index fdbec979..ec807d92 100644
--- a/proxmox-http/src/websocket/mod.rs
+++ b/proxmox-http/src/websocket/mod.rs
@@ -9,10 +9,10 @@ use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use futures::select;
use hyper::header::{
- HeaderMap, HeaderValue, CONNECTION, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY,
+ CONNECTION, HeaderMap, HeaderValue, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY,
SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION, UPGRADE,
};
use hyper::{Body, Response, StatusCode};
diff --git a/proxmox-human-byte/src/lib.rs b/proxmox-human-byte/src/lib.rs
index 9f728fad..e6381d93 100644
--- a/proxmox-human-byte/src/lib.rs
+++ b/proxmox-human-byte/src/lib.rs
@@ -1,6 +1,6 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_schema::{ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType};
diff --git a/proxmox-io/src/lib.rs b/proxmox-io/src/lib.rs
index 1be005ff..74c11f2d 100644
--- a/proxmox-io/src/lib.rs
+++ b/proxmox-io/src/lib.rs
@@ -13,7 +13,7 @@ mod write;
pub use write::WriteExt;
mod sparse_copy;
-pub use sparse_copy::{buffer_is_zero, sparse_copy, SparseCopyResult};
+pub use sparse_copy::{SparseCopyResult, buffer_is_zero, sparse_copy};
#[cfg(feature = "tokio")]
pub use sparse_copy::sparse_copy_async;
diff --git a/proxmox-lang/src/lib.rs b/proxmox-lang/src/lib.rs
index 0abfd507..7e9b2200 100644
--- a/proxmox-lang/src/lib.rs
+++ b/proxmox-lang/src/lib.rs
@@ -102,7 +102,5 @@ macro_rules! offsetof {
#[deprecated = "use c\"literals\" instead"]
#[macro_export]
macro_rules! c_str {
- ($data:expr) => {{
- unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(concat!($data, "\0").as_bytes()) }
- }};
+ ($data:expr) => {{ unsafe { ::std::ffi::CStr::from_bytes_with_nul_unchecked(concat!($data, "\0").as_bytes()) } }};
}
diff --git a/proxmox-ldap/src/lib.rs b/proxmox-ldap/src/lib.rs
index 31f118ad..784767c0 100644
--- a/proxmox-ldap/src/lib.rs
+++ b/proxmox-ldap/src/lib.rs
@@ -8,7 +8,7 @@ use std::{
time::Duration,
};
-use anyhow::{bail, format_err, Context, Error};
+use anyhow::{Context, Error, bail, format_err};
use ldap3::adapters::{Adapter, EntriesOnly, PagedResults};
use ldap3::{Ldap, LdapConnAsync, LdapConnSettings, LdapResult, Scope, SearchEntry};
use native_tls::{Certificate, TlsConnector, TlsConnectorBuilder};
diff --git a/proxmox-ldap/tests/glauth.rs b/proxmox-ldap/tests/glauth.rs
index d497018c..5ec5d7e8 100644
--- a/proxmox-ldap/tests/glauth.rs
+++ b/proxmox-ldap/tests/glauth.rs
@@ -151,13 +151,14 @@ fn test_search() -> Result<(), Error> {
assert!(a.dn.starts_with("cn=test"));
assert!(a.dn.ends_with("ou=testgroup,ou=users,dc=example,dc=com"));
- assert!(a
- .attributes
- .get("mail")
- .unwrap()
- .first()
- .unwrap()
- .ends_with("@example.com"));
+ assert!(
+ a.attributes
+ .get("mail")
+ .unwrap()
+ .first()
+ .unwrap()
+ .ends_with("@example.com")
+ );
assert!(a.attributes.get("sn").unwrap().first().unwrap().eq("User"));
}
diff --git a/proxmox-log/src/file_logger.rs b/proxmox-log/src/file_logger.rs
index 1e67b450..b5d28ace 100644
--- a/proxmox-log/src/file_logger.rs
+++ b/proxmox-log/src/file_logger.rs
@@ -3,7 +3,7 @@ use std::io::Write;
use anyhow::Error;
use nix::fcntl::OFlag;
-use proxmox_sys::fs::{atomic_open_or_create_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, atomic_open_or_create_file};
/// Options to control the behavior of a [FileLogger] instance
#[derive(Default)]
diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs
index 8c74e42b..4b754a34 100644
--- a/proxmox-log/src/lib.rs
+++ b/proxmox-log/src/lib.rs
@@ -17,6 +17,7 @@ pub use file_logger::{FileLogOptions, FileLogger};
mod tasklog_layer;
+pub use tracing::Level;
pub use tracing::debug;
pub use tracing::debug_span;
pub use tracing::enabled;
@@ -31,7 +32,6 @@ pub use tracing::trace;
pub use tracing::trace_span;
pub use tracing::warn;
pub use tracing::warn_span;
-pub use tracing::Level;
pub use tracing_subscriber::filter::LevelFilter;
tokio::task_local! {
diff --git a/proxmox-log/src/tasklog_layer.rs b/proxmox-log/src/tasklog_layer.rs
index 48fd7c1e..d2b7ffc5 100644
--- a/proxmox-log/src/tasklog_layer.rs
+++ b/proxmox-log/src/tasklog_layer.rs
@@ -1,12 +1,12 @@
use std::fmt::Write as _;
-use tracing::field::Field;
-use tracing::field::Visit;
use tracing::Event;
use tracing::Level;
use tracing::Subscriber;
-use tracing_subscriber::layer::Context;
+use tracing::field::Field;
+use tracing::field::Visit;
use tracing_subscriber::Layer;
+use tracing_subscriber::layer::Context;
use crate::{FileLogState, LogContext};
diff --git a/proxmox-metrics/src/influxdb/http.rs b/proxmox-metrics/src/influxdb/http.rs
index d773c16f..1a686bf9 100644
--- a/proxmox-metrics/src/influxdb/http.rs
+++ b/proxmox-metrics/src/influxdb/http.rs
@@ -1,12 +1,12 @@
use std::sync::Arc;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use hyper::Body;
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
use tokio::sync::mpsc;
-use proxmox_http::client::Client;
use proxmox_http::HttpOptions;
+use proxmox_http::client::Client;
use crate::influxdb::utils;
use crate::{Metrics, MetricsData};
diff --git a/proxmox-metrics/src/influxdb/utils.rs b/proxmox-metrics/src/influxdb/utils.rs
index 05e304f4..0f9a7288 100644
--- a/proxmox-metrics/src/influxdb/utils.rs
+++ b/proxmox-metrics/src/influxdb/utils.rs
@@ -1,6 +1,6 @@
use std::fmt::Write;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde_json::Value;
use crate::MetricsData;
diff --git a/proxmox-metrics/src/lib.rs b/proxmox-metrics/src/lib.rs
index 84e7f07d..cf7bc814 100644
--- a/proxmox-metrics/src/lib.rs
+++ b/proxmox-metrics/src/lib.rs
@@ -4,7 +4,7 @@ use std::borrow::Cow;
use std::collections::HashMap;
use std::sync::Arc;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::Serialize;
use serde_json::Value;
use tokio::sync::mpsc;
diff --git a/proxmox-network-api/src/api_impl.rs b/proxmox-network-api/src/api_impl.rs
index 18602900..9d956e2c 100644
--- a/proxmox-network-api/src/api_impl.rs
+++ b/proxmox-network-api/src/api_impl.rs
@@ -1,12 +1,12 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_config_digest::ConfigDigest;
-use crate::{parse_vlan_id_from_name, parse_vlan_raw_device_from_name};
use crate::{
DeletableInterfaceProperty, Interface, InterfaceUpdater, LinuxBondMode, NetworkConfigMethod,
NetworkInterfaceType,
};
+use crate::{parse_vlan_id_from_name, parse_vlan_raw_device_from_name};
/// Create network interface configuration.
pub fn create_interface(iface: String, config: InterfaceUpdater) -> Result<(), Error> {
@@ -99,7 +99,9 @@ pub fn create_interface(iface: String, config: InterfaceUpdater) -> Result<(), E
}
if config.bond_xmit_hash_policy.is_some() {
if mode != LinuxBondMode::Ieee802_3ad && mode != LinuxBondMode::BalanceXor {
- bail!("bond_xmit_hash_policy is only valid with LACP(802.3ad) or balance-xor mode");
+ bail!(
+ "bond_xmit_hash_policy is only valid with LACP(802.3ad) or balance-xor mode"
+ );
}
interface.bond_xmit_hash_policy = config.bond_xmit_hash_policy;
}
diff --git a/proxmox-network-api/src/api_types.rs b/proxmox-network-api/src/api_types.rs
index 9f12b029..8dcc2526 100644
--- a/proxmox-network-api/src/api_types.rs
+++ b/proxmox-network-api/src/api_types.rs
@@ -1,19 +1,19 @@
use std::fmt;
use std::sync::LazyLock;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
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;
+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};
pub static PHYSICAL_NIC_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^(?:eth\d+|en[^:.]+|ib\d+)$").unwrap());
diff --git a/proxmox-network-api/src/config/helper.rs b/proxmox-network-api/src/config/helper.rs
index 9cc23eef..aea5665c 100644
--- a/proxmox-network-api/src/config/helper.rs
+++ b/proxmox-network-api/src/config/helper.rs
@@ -4,10 +4,10 @@ use std::path::Path;
use std::process::Command;
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use const_format::concatcp;
use nix::ioctl_read_bad;
-use nix::sys::socket::{socket, AddressFamily, SockFlag, SockType};
+use nix::sys::socket::{AddressFamily, SockFlag, SockType, socket};
use regex::Regex;
use proxmox_schema::api_types::IPV4RE_STR;
diff --git a/proxmox-network-api/src/config/mod.rs b/proxmox-network-api/src/config/mod.rs
index 054f53c8..752a2165 100644
--- a/proxmox-network-api/src/config/mod.rs
+++ b/proxmox-network-api/src/config/mod.rs
@@ -8,9 +8,9 @@ use std::collections::{BTreeMap, HashMap, HashSet};
use std::io::Write;
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use regex::Regex;
-use serde::de::{value, Deserialize, IntoDeserializer};
+use serde::de::{Deserialize, IntoDeserializer, value};
use super::{
BondXmitHashPolicy, Interface, LinuxBondMode, NetworkConfigMethod, NetworkInterfaceType,
@@ -21,7 +21,7 @@ use helper::get_network_interfaces;
use parser::NetworkParser;
use proxmox_config_digest::ConfigDigest;
-use proxmox_product_config::{open_api_lockfile, replace_system_config, ApiLockGuard};
+use proxmox_product_config::{ApiLockGuard, open_api_lockfile, replace_system_config};
static PHYSICAL_NIC_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^(?:eth\d+|en[^:.]+|ib\d+)$").unwrap());
diff --git a/proxmox-network-api/src/config/parser.rs b/proxmox-network-api/src/config/parser.rs
index d05a67b0..200a88c0 100644
--- a/proxmox-network-api/src/config/parser.rs
+++ b/proxmox-network-api/src/config/parser.rs
@@ -5,9 +5,9 @@ use std::io::BufRead;
use std::iter::{Iterator, Peekable};
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use regex::Regex;
-use serde::de::{value, Deserialize, IntoDeserializer};
+use serde::de::{Deserialize, IntoDeserializer, value};
use super::helper::*;
use super::lexer::*;
diff --git a/proxmox-notify/src/api/gotify.rs b/proxmox-notify/src/api/gotify.rs
index 27b9c317..5155fd2c 100644
--- a/proxmox-notify/src/api/gotify.rs
+++ b/proxmox-notify/src/api/gotify.rs
@@ -1,11 +1,11 @@
use proxmox_http_error::HttpError;
+use crate::Config;
use crate::api::http_err;
use crate::endpoints::gotify::{
- DeleteableGotifyProperty, GotifyConfig, GotifyConfigUpdater, GotifyPrivateConfig,
- GotifyPrivateConfigUpdater, GOTIFY_TYPENAME,
+ DeleteableGotifyProperty, GOTIFY_TYPENAME, GotifyConfig, GotifyConfigUpdater,
+ GotifyPrivateConfig, GotifyPrivateConfigUpdater,
};
-use crate::Config;
/// Get a list of all gotify endpoints.
///
@@ -193,15 +193,17 @@ mod tests {
fn test_update_not_existing_returns_error() -> Result<(), HttpError> {
let mut config = empty_config();
- assert!(update_endpoint(
- &mut config,
- "test",
- Default::default(),
- Default::default(),
- None,
- None
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "test",
+ Default::default(),
+ Default::default(),
+ None,
+ None
+ )
+ .is_err()
+ );
Ok(())
}
@@ -211,15 +213,17 @@ mod tests {
let mut config = empty_config();
add_default_gotify_endpoint(&mut config)?;
- assert!(update_endpoint(
- &mut config,
- "gotify-endpoint",
- Default::default(),
- Default::default(),
- None,
- Some(&[0; 32])
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "gotify-endpoint",
+ Default::default(),
+ Default::default(),
+ None,
+ Some(&[0; 32])
+ )
+ .is_err()
+ );
Ok(())
}
diff --git a/proxmox-notify/src/api/matcher.rs b/proxmox-notify/src/api/matcher.rs
index f5605acb..b2bf15ae 100644
--- a/proxmox-notify/src/api/matcher.rs
+++ b/proxmox-notify/src/api/matcher.rs
@@ -1,10 +1,10 @@
use proxmox_http_error::HttpError;
+use crate::Config;
use crate::api::http_err;
use crate::matcher::{
- DeleteableMatcherProperty, MatcherConfig, MatcherConfigUpdater, MATCHER_TYPENAME,
+ DeleteableMatcherProperty, MATCHER_TYPENAME, MatcherConfig, MatcherConfigUpdater,
};
-use crate::Config;
/// Get a list of all matchers
///
@@ -182,14 +182,16 @@ matcher: matcher2
#[test]
fn test_update_invalid_digest_returns_error() -> Result<(), HttpError> {
let mut config = config_with_two_matchers();
- assert!(update_matcher(
- &mut config,
- "matcher1",
- Default::default(),
- None,
- Some(&[0u8; 32])
- )
- .is_err());
+ assert!(
+ update_matcher(
+ &mut config,
+ "matcher1",
+ Default::default(),
+ None,
+ Some(&[0u8; 32])
+ )
+ .is_err()
+ );
Ok(())
}
diff --git a/proxmox-notify/src/api/sendmail.rs b/proxmox-notify/src/api/sendmail.rs
index e0adb64b..eaafd001 100644
--- a/proxmox-notify/src/api/sendmail.rs
+++ b/proxmox-notify/src/api/sendmail.rs
@@ -1,10 +1,10 @@
use proxmox_http_error::HttpError;
+use crate::Config;
use crate::api::{http_bail, http_err};
use crate::endpoints::sendmail::{
- DeleteableSendmailProperty, SendmailConfig, SendmailConfigUpdater, SENDMAIL_TYPENAME,
+ DeleteableSendmailProperty, SENDMAIL_TYPENAME, SendmailConfig, SendmailConfigUpdater,
};
-use crate::Config;
/// Get a list of all sendmail endpoints.
///
@@ -203,21 +203,23 @@ pub mod tests {
let mut config = empty_config();
add_sendmail_endpoint_for_test(&mut config, "sendmail-endpoint")?;
- assert!(update_endpoint(
- &mut config,
- "sendmail-endpoint",
- SendmailConfigUpdater {
- mailto: Some(vec!["user2@example.com".into(), "user3@example.com".into()]),
- mailto_user: None,
- from_address: Some("root@example.com".into()),
- author: Some("newauthor".into()),
- comment: Some("new comment".into()),
- ..Default::default()
- },
- None,
- Some(&[0; 32]),
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "sendmail-endpoint",
+ SendmailConfigUpdater {
+ mailto: Some(vec!["user2@example.com".into(), "user3@example.com".into()]),
+ mailto_user: None,
+ from_address: Some("root@example.com".into()),
+ author: Some("newauthor".into()),
+ comment: Some("new comment".into()),
+ ..Default::default()
+ },
+ None,
+ Some(&[0; 32]),
+ )
+ .is_err()
+ );
Ok(())
}
diff --git a/proxmox-notify/src/api/smtp.rs b/proxmox-notify/src/api/smtp.rs
index 470701bf..41a94581 100644
--- a/proxmox-notify/src/api/smtp.rs
+++ b/proxmox-notify/src/api/smtp.rs
@@ -1,11 +1,11 @@
use proxmox_http_error::HttpError;
+use crate::Config;
use crate::api::{http_bail, http_err};
use crate::endpoints::smtp::{
- DeleteableSmtpProperty, SmtpConfig, SmtpConfigUpdater, SmtpPrivateConfig,
- SmtpPrivateConfigUpdater, SMTP_TYPENAME,
+ DeleteableSmtpProperty, SMTP_TYPENAME, SmtpConfig, SmtpConfigUpdater, SmtpPrivateConfig,
+ SmtpPrivateConfigUpdater,
};
-use crate::Config;
/// Get a list of all smtp endpoints.
///
@@ -249,15 +249,17 @@ pub mod tests {
fn test_update_not_existing_returns_error() -> Result<(), HttpError> {
let mut config = empty_config();
- assert!(update_endpoint(
- &mut config,
- "test",
- Default::default(),
- Default::default(),
- None,
- None,
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "test",
+ Default::default(),
+ Default::default(),
+ None,
+ None,
+ )
+ .is_err()
+ );
Ok(())
}
@@ -267,15 +269,17 @@ pub mod tests {
let mut config = empty_config();
add_smtp_endpoint_for_test(&mut config, "sendmail-endpoint")?;
- assert!(update_endpoint(
- &mut config,
- "sendmail-endpoint",
- Default::default(),
- Default::default(),
- None,
- Some(&[0; 32]),
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "sendmail-endpoint",
+ Default::default(),
+ Default::default(),
+ None,
+ Some(&[0; 32]),
+ )
+ .is_err()
+ );
Ok(())
}
diff --git a/proxmox-notify/src/api/webhook.rs b/proxmox-notify/src/api/webhook.rs
index 31c5c869..678d6542 100644
--- a/proxmox-notify/src/api/webhook.rs
+++ b/proxmox-notify/src/api/webhook.rs
@@ -7,10 +7,10 @@ use proxmox_schema::property_string::PropertyString;
use crate::api::http_err;
use crate::endpoints::webhook::{
- DeleteableWebhookProperty, KeyAndBase64Val, WebhookConfig, WebhookConfigUpdater,
- WebhookPrivateConfig, WEBHOOK_TYPENAME,
+ DeleteableWebhookProperty, KeyAndBase64Val, WEBHOOK_TYPENAME, WebhookConfig,
+ WebhookConfigUpdater, WebhookPrivateConfig,
};
-use crate::{http_bail, Config};
+use crate::{Config, http_bail};
use super::remove_private_config_entry;
use super::set_private_config_entry;
@@ -303,11 +303,10 @@ mod tests {
name: "webhook-endpoint".into(),
method: HttpMethod::Post,
url: "http://example.com/webhook".into(),
- header: vec![KeyAndBase64Val::new_with_plain_value(
- "Content-Type",
- "application/json",
- )
- .into()],
+ header: vec![
+ KeyAndBase64Val::new_with_plain_value("Content-Type", "application/json")
+ .into(),
+ ],
body: Some(encode("this is the body")),
comment: Some("comment".into()),
disable: Some(false),
@@ -334,14 +333,16 @@ mod tests {
let mut config = empty_config();
add_default_webhook_endpoint(&mut config)?;
- assert!(update_endpoint(
- &mut config,
- "webhook-endpoint",
- Default::default(),
- None,
- Some(&[0; 32])
- )
- .is_err());
+ assert!(
+ update_endpoint(
+ &mut config,
+ "webhook-endpoint",
+ Default::default(),
+ None,
+ Some(&[0; 32])
+ )
+ .is_err()
+ );
Ok(())
}
diff --git a/proxmox-notify/src/config.rs b/proxmox-notify/src/config.rs
index 791e0b5f..7415a0c0 100644
--- a/proxmox-notify/src/config.rs
+++ b/proxmox-notify/src/config.rs
@@ -5,11 +5,11 @@ use tracing::warn;
use proxmox_schema::{ApiType, ObjectSchema};
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
-use crate::filter::{FilterConfig, FILTER_TYPENAME};
-use crate::group::{GroupConfig, GROUP_TYPENAME};
-use crate::matcher::{MatcherConfig, MATCHER_TYPENAME};
-use crate::schema::BACKEND_NAME_SCHEMA;
use crate::Error;
+use crate::filter::{FILTER_TYPENAME, FilterConfig};
+use crate::group::{GROUP_TYPENAME, GroupConfig};
+use crate::matcher::{MATCHER_TYPENAME, MatcherConfig};
+use crate::schema::BACKEND_NAME_SCHEMA;
/// Section config schema for the public config file.
pub fn config_parser() -> &'static SectionConfig {
@@ -28,7 +28,7 @@ fn config_init() -> SectionConfig {
#[cfg(feature = "sendmail")]
{
- use crate::endpoints::sendmail::{SendmailConfig, SENDMAIL_TYPENAME};
+ use crate::endpoints::sendmail::{SENDMAIL_TYPENAME, SendmailConfig};
const SENDMAIL_SCHEMA: &ObjectSchema = SendmailConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -39,7 +39,7 @@ fn config_init() -> SectionConfig {
}
#[cfg(feature = "smtp")]
{
- use crate::endpoints::smtp::{SmtpConfig, SMTP_TYPENAME};
+ use crate::endpoints::smtp::{SMTP_TYPENAME, SmtpConfig};
const SMTP_SCHEMA: &ObjectSchema = SmtpConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -50,7 +50,7 @@ fn config_init() -> SectionConfig {
}
#[cfg(feature = "gotify")]
{
- use crate::endpoints::gotify::{GotifyConfig, GOTIFY_TYPENAME};
+ use crate::endpoints::gotify::{GOTIFY_TYPENAME, GotifyConfig};
const GOTIFY_SCHEMA: &ObjectSchema = GotifyConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -61,7 +61,7 @@ fn config_init() -> SectionConfig {
}
#[cfg(feature = "webhook")]
{
- use crate::endpoints::webhook::{WebhookConfig, WEBHOOK_TYPENAME};
+ use crate::endpoints::webhook::{WEBHOOK_TYPENAME, WebhookConfig};
const WEBHOOK_SCHEMA: &ObjectSchema = WebhookConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -101,7 +101,7 @@ fn private_config_init() -> SectionConfig {
#[cfg(feature = "gotify")]
{
- use crate::endpoints::gotify::{GotifyPrivateConfig, GOTIFY_TYPENAME};
+ use crate::endpoints::gotify::{GOTIFY_TYPENAME, GotifyPrivateConfig};
const GOTIFY_SCHEMA: &ObjectSchema = GotifyPrivateConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -113,7 +113,7 @@ fn private_config_init() -> SectionConfig {
#[cfg(feature = "smtp")]
{
- use crate::endpoints::smtp::{SmtpPrivateConfig, SMTP_TYPENAME};
+ use crate::endpoints::smtp::{SMTP_TYPENAME, SmtpPrivateConfig};
const SMTP_SCHEMA: &ObjectSchema = SmtpPrivateConfig::API_SCHEMA.unwrap_object_schema();
config.register_plugin(SectionConfigPlugin::new(
@@ -125,7 +125,7 @@ fn private_config_init() -> SectionConfig {
#[cfg(feature = "webhook")]
{
- use crate::endpoints::webhook::{WebhookPrivateConfig, WEBHOOK_TYPENAME};
+ use crate::endpoints::webhook::{WEBHOOK_TYPENAME, WebhookPrivateConfig};
const WEBHOOK_SCHEMA: &ObjectSchema =
WebhookPrivateConfig::API_SCHEMA.unwrap_object_schema();
diff --git a/proxmox-notify/src/context/pbs.rs b/proxmox-notify/src/context/pbs.rs
index e8106c57..ab360cc4 100644
--- a/proxmox-notify/src/context/pbs.rs
+++ b/proxmox-notify/src/context/pbs.rs
@@ -6,8 +6,8 @@ use tracing::error;
use proxmox_schema::{ObjectSchema, Schema, StringSchema};
use proxmox_section_config::{SectionConfig, SectionConfigPlugin};
-use crate::context::{common, Context};
use crate::Error;
+use crate::context::{Context, common};
const PBS_USER_CFG_FILENAME: &str = "/etc/proxmox-backup/user.cfg";
const PBS_NODE_CFG_FILENAME: &str = "/etc/proxmox-backup/node.cfg";
diff --git a/proxmox-notify/src/context/pve.rs b/proxmox-notify/src/context/pve.rs
index d49ab27c..6025ef0b 100644
--- a/proxmox-notify/src/context/pve.rs
+++ b/proxmox-notify/src/context/pve.rs
@@ -1,5 +1,5 @@
-use crate::context::{common, Context};
use crate::Error;
+use crate::context::{Context, common};
use std::path::Path;
fn lookup_mail_address(content: &str, user: &str) -> Option<String> {
diff --git a/proxmox-notify/src/context/test.rs b/proxmox-notify/src/context/test.rs
index 5df25d05..d1e5ef9d 100644
--- a/proxmox-notify/src/context/test.rs
+++ b/proxmox-notify/src/context/test.rs
@@ -1,5 +1,5 @@
-use crate::context::Context;
use crate::Error;
+use crate::context::Context;
#[derive(Debug)]
pub struct TestContext;
diff --git a/proxmox-notify/src/endpoints/gotify.rs b/proxmox-notify/src/endpoints/gotify.rs
index 3e977131..94b74ef6 100644
--- a/proxmox-notify/src/endpoints/gotify.rs
+++ b/proxmox-notify/src/endpoints/gotify.rs
@@ -7,12 +7,12 @@ use serde_json::json;
use proxmox_http::client::sync::Client;
use proxmox_http::{HttpClient, HttpOptions, ProxyConfig};
use proxmox_schema::api_types::COMMENT_SCHEMA;
-use proxmox_schema::{api, Updater};
+use proxmox_schema::{Updater, api};
use crate::context::context;
use crate::renderer::TemplateType;
use crate::schema::ENTITY_NAME_SCHEMA;
-use crate::{renderer, Content, Endpoint, Error, Notification, Origin, Severity};
+use crate::{Content, Endpoint, Error, Notification, Origin, Severity, renderer};
const HTTP_TIMEOUT: Duration = Duration::from_secs(10);
diff --git a/proxmox-notify/src/endpoints/sendmail.rs b/proxmox-notify/src/endpoints/sendmail.rs
index 70b0f111..4f26a121 100644
--- a/proxmox-notify/src/endpoints/sendmail.rs
+++ b/proxmox-notify/src/endpoints/sendmail.rs
@@ -2,13 +2,13 @@ use proxmox_sendmail::Mail;
use serde::{Deserialize, Serialize};
use proxmox_schema::api_types::COMMENT_SCHEMA;
-use proxmox_schema::{api, Updater};
+use proxmox_schema::{Updater, api};
use crate::context;
use crate::endpoints::common::mail;
use crate::renderer::TemplateType;
use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA};
-use crate::{renderer, Content, Endpoint, Error, Notification, Origin};
+use crate::{Content, Endpoint, Error, Notification, Origin, renderer};
pub(crate) const SENDMAIL_TYPENAME: &str = "sendmail";
diff --git a/proxmox-notify/src/endpoints/smtp.rs b/proxmox-notify/src/endpoints/smtp.rs
index 4521e04a..7b00deb3 100644
--- a/proxmox-notify/src/endpoints/smtp.rs
+++ b/proxmox-notify/src/endpoints/smtp.rs
@@ -3,17 +3,17 @@ use std::time::Duration;
use lettre::message::header::{HeaderName, HeaderValue};
use lettre::message::{Mailbox, MultiPart, SinglePart};
use lettre::transport::smtp::client::{Tls, TlsParameters};
-use lettre::{message::header::ContentType, Message, SmtpTransport, Transport};
+use lettre::{Message, SmtpTransport, Transport, message::header::ContentType};
use serde::{Deserialize, Serialize};
use proxmox_schema::api_types::COMMENT_SCHEMA;
-use proxmox_schema::{api, Updater};
+use proxmox_schema::{Updater, api};
use crate::context::context;
use crate::endpoints::common::mail;
use crate::renderer::TemplateType;
use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA};
-use crate::{renderer, Content, Endpoint, Error, Notification, Origin};
+use crate::{Content, Endpoint, Error, Notification, Origin, renderer};
pub(crate) const SMTP_TYPENAME: &str = "smtp";
@@ -252,8 +252,8 @@ impl Endpoint for SmtpEndpoint {
}
#[cfg(feature = "mail-forwarder")]
Content::ForwardedMail { raw, title, .. } => {
- use lettre::message::header::ContentTransferEncoding;
use lettre::message::Body;
+ use lettre::message::header::ContentTransferEncoding;
use tracing::error;
let parsed_message = mail_parser::Message::parse(raw)
diff --git a/proxmox-notify/src/endpoints/webhook.rs b/proxmox-notify/src/endpoints/webhook.rs
index 34dbac54..165d84de 100644
--- a/proxmox-notify/src/endpoints/webhook.rs
+++ b/proxmox-notify/src/endpoints/webhook.rs
@@ -17,17 +17,17 @@ use http::Request;
use percent_encoding::AsciiSet;
use proxmox_schema::property_string::PropertyString;
use serde::{Deserialize, Serialize};
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
use proxmox_http::client::sync::Client;
use proxmox_http::{HttpClient, HttpOptions, ProxyConfig};
use proxmox_schema::api_types::{COMMENT_SCHEMA, HTTP_URL_SCHEMA};
-use proxmox_schema::{api, ApiStringFormat, ApiType, Schema, StringSchema, Updater};
+use proxmox_schema::{ApiStringFormat, ApiType, Schema, StringSchema, Updater, api};
use crate::context::context;
use crate::renderer::TemplateType;
use crate::schema::ENTITY_NAME_SCHEMA;
-use crate::{renderer, Content, Endpoint, Error, Notification, Origin};
+use crate::{Content, Endpoint, Error, Notification, Origin, renderer};
/// This will be used as a section type in the public/private configuration file.
pub(crate) const WEBHOOK_TYPENAME: &str = "webhook";
diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs
index 12e59474..638d34d9 100644
--- a/proxmox-notify/src/lib.rs
+++ b/proxmox-notify/src/lib.rs
@@ -7,8 +7,8 @@ use std::str::FromStr;
use context::context;
use serde::{Deserialize, Serialize};
-use serde_json::json;
use serde_json::Value;
+use serde_json::json;
use tracing::{error, info};
use proxmox_schema::api;
@@ -16,7 +16,7 @@ use proxmox_section_config::SectionConfigData;
use proxmox_uuid::Uuid;
pub mod matcher;
-use matcher::{MatcherConfig, MATCHER_TYPENAME};
+use matcher::{MATCHER_TYPENAME, MatcherConfig};
pub mod api;
pub mod config;
diff --git a/proxmox-notify/src/matcher.rs b/proxmox-notify/src/matcher.rs
index 083c2dbd..9964e4bf 100644
--- a/proxmox-notify/src/matcher.rs
+++ b/proxmox-notify/src/matcher.rs
@@ -9,8 +9,8 @@ use serde::{Deserialize, Serialize};
use tracing::{error, info};
use proxmox_schema::api_types::{COMMENT_SCHEMA, SAFE_ID_REGEX_STR};
-use proxmox_schema::{api, const_regex, ApiStringFormat, Schema, StringSchema, Updater};
-use proxmox_time::{parse_daily_duration, DailyDuration};
+use proxmox_schema::{ApiStringFormat, Schema, StringSchema, Updater, api, const_regex};
+use proxmox_time::{DailyDuration, parse_daily_duration};
use crate::schema::ENTITY_NAME_SCHEMA;
use crate::{Error, Notification, Origin, Severity};
diff --git a/proxmox-notify/src/renderer/mod.rs b/proxmox-notify/src/renderer/mod.rs
index e058ea22..8be6f057 100644
--- a/proxmox-notify/src/renderer/mod.rs
+++ b/proxmox-notify/src/renderer/mod.rs
@@ -13,7 +13,7 @@ use tracing::error;
use proxmox_human_byte::HumanByte;
use proxmox_time::TimeSpan;
-use crate::{context, Error};
+use crate::{Error, context};
mod html;
mod plaintext;
diff --git a/proxmox-openid/src/auth_state.rs b/proxmox-openid/src/auth_state.rs
index f2a299a0..a5ac71cd 100644
--- a/proxmox-openid/src/auth_state.rs
+++ b/proxmox-openid/src/auth_state.rs
@@ -1,9 +1,9 @@
use std::path::{Path, PathBuf};
-use anyhow::{bail, Error};
-use serde_json::{json, Value};
+use anyhow::{Error, bail};
+use serde_json::{Value, json};
-use proxmox_sys::fs::{file_get_json, open_file_locked, replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, file_get_json, open_file_locked, replace_file};
use proxmox_time::epoch_i64;
use super::{PrivateAuthState, PublicAuthState};
diff --git a/proxmox-openid/src/http_client.rs b/proxmox-openid/src/http_client.rs
index 1850d64e..10d649d0 100644
--- a/proxmox-openid/src/http_client.rs
+++ b/proxmox-openid/src/http_client.rs
@@ -1,7 +1,7 @@
use std::env;
use std::sync::Arc;
-use http::header::{HeaderMap, HeaderValue, CONTENT_TYPE};
+use http::header::{CONTENT_TYPE, HeaderMap, HeaderValue};
use http::method::Method;
use http::status::StatusCode;
diff --git a/proxmox-openid/src/lib.rs b/proxmox-openid/src/lib.rs
index fe65fded..4683eed3 100644
--- a/proxmox-openid/src/lib.rs
+++ b/proxmox-openid/src/lib.rs
@@ -2,7 +2,7 @@
use std::path::Path;
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -13,11 +13,6 @@ mod auth_state;
pub use auth_state::*;
use openidconnect::{
- //curl::http_client,
- core::{
- CoreAuthDisplay, CoreAuthPrompt, CoreAuthenticationFlow, CoreClient, CoreGenderClaim,
- CoreIdTokenClaims, CoreIdTokenVerifier, CoreProviderMetadata,
- },
AdditionalClaims,
AuthenticationContextClass,
AuthorizationCode,
@@ -32,6 +27,11 @@ use openidconnect::{
RedirectUrl,
Scope,
UserInfoClaims,
+ //curl::http_client,
+ core::{
+ CoreAuthDisplay, CoreAuthPrompt, CoreAuthenticationFlow, CoreClient, CoreGenderClaim,
+ CoreIdTokenClaims, CoreIdTokenVerifier, CoreProviderMetadata,
+ },
};
/// Stores Additional Claims into a serde_json::Value;
diff --git a/proxmox-rest-server/examples/minimal-rest-server.rs b/proxmox-rest-server/examples/minimal-rest-server.rs
index d6a5f2eb..0bed3f05 100644
--- a/proxmox-rest-server/examples/minimal-rest-server.rs
+++ b/proxmox-rest-server/examples/minimal-rest-server.rs
@@ -3,13 +3,13 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::{LazyLock, Mutex};
-use anyhow::{bail, format_err, Error};
-use http::request::Parts;
+use anyhow::{Error, bail, format_err};
use http::HeaderMap;
+use http::request::Parts;
use hyper::{Body, Method, Response};
use proxmox_router::{
- list_subdirs_api_method, Router, RpcEnvironmentType, SubdirMap, UserInformation,
+ Router, RpcEnvironmentType, SubdirMap, UserInformation, list_subdirs_api_method,
};
use proxmox_schema::api;
diff --git a/proxmox-rest-server/src/api_config.rs b/proxmox-rest-server/src/api_config.rs
index 7dbcad52..0765b517 100644
--- a/proxmox-rest-server/src/api_config.rs
+++ b/proxmox-rest-server/src/api_config.rs
@@ -6,7 +6,7 @@ use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll};
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use http::{HeaderMap, Method, Uri};
use hyper::http::request::Parts;
use hyper::{Body, Response};
@@ -15,10 +15,10 @@ use tower_service::Service;
use proxmox_daemon::command_socket::CommandSocket;
use proxmox_log::{FileLogOptions, FileLogger};
use proxmox_router::{Router, RpcEnvironmentType, UserInformation};
-use proxmox_sys::fs::{create_path, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, create_path};
-use crate::rest::Handler;
use crate::RestEnvironment;
+use crate::rest::Handler;
/// REST server configuration
pub struct ApiConfig {
@@ -324,7 +324,7 @@ mod templates {
use std::sync::RwLock;
use std::time::SystemTime;
- use anyhow::{bail, format_err, Error};
+ use anyhow::{Error, bail, format_err};
use handlebars::Handlebars;
use serde::Serialize;
diff --git a/proxmox-rest-server/src/compression.rs b/proxmox-rest-server/src/compression.rs
index 189d7041..f8d25e34 100644
--- a/proxmox-rest-server/src/compression.rs
+++ b/proxmox-rest-server/src/compression.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use hyper::header;
/// Possible Compression Methods, order determines preference (later is preferred)
diff --git a/proxmox-rest-server/src/connection.rs b/proxmox-rest-server/src/connection.rs
index 526555ae..1877a3a2 100644
--- a/proxmox-rest-server/src/connection.rs
+++ b/proxmox-rest-server/src/connection.rs
@@ -8,11 +8,11 @@ use std::net::SocketAddr;
use std::os::fd::FromRawFd;
use std::os::unix::io::AsRawFd;
use std::path::PathBuf;
-use std::pin::{pin, Pin};
+use std::pin::{Pin, pin};
use std::sync::{Arc, Mutex};
use std::time::Duration;
-use anyhow::{format_err, Context, Error};
+use anyhow::{Context, Error, format_err};
use futures::FutureExt;
use hyper::server::accept;
use openssl::ec::{EcGroup, EcKey};
@@ -357,7 +357,7 @@ impl AcceptBuilder {
let (socket, peer) = match listener.accept().await {
Ok(connection) => connection,
Err(error) => {
- return Err(format_err!(error)).context("error while accepting tcp stream")
+ return Err(format_err!(error)).context("error while accepting tcp stream");
}
};
@@ -461,7 +461,9 @@ impl AcceptBuilder {
let insecure_stream = Box::pin(state.socket);
if let Err(send_err) = insecure_sender.send(Ok(insecure_stream)).await {
- log::error!("[{peer}] failed to accept connection - connection channel closed: {send_err}");
+ log::error!(
+ "[{peer}] failed to accept connection - connection channel closed: {send_err}"
+ );
}
}
Err(err) => {
diff --git a/proxmox-rest-server/src/environment.rs b/proxmox-rest-server/src/environment.rs
index ca41bb50..81559a4b 100644
--- a/proxmox-rest-server/src/environment.rs
+++ b/proxmox-rest-server/src/environment.rs
@@ -1,7 +1,7 @@
use std::net::SocketAddr;
use std::sync::Arc;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
diff --git a/proxmox-rest-server/src/formatter.rs b/proxmox-rest-server/src/formatter.rs
index 32ca9936..7bbec86d 100644
--- a/proxmox-rest-server/src/formatter.rs
+++ b/proxmox-rest-server/src/formatter.rs
@@ -2,7 +2,7 @@
use std::collections::HashMap;
use anyhow::Error;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use hyper::header;
use hyper::{Body, Response, StatusCode};
diff --git a/proxmox-rest-server/src/h2service.rs b/proxmox-rest-server/src/h2service.rs
index db6e3b0a..efe02049 100644
--- a/proxmox-rest-server/src/h2service.rs
+++ b/proxmox-rest-server/src/h2service.rs
@@ -12,7 +12,7 @@ use proxmox_router::http_err;
use proxmox_router::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
use crate::formatter::*;
-use crate::{normalize_path_with_components, WorkerTask};
+use crate::{WorkerTask, normalize_path_with_components};
/// Hyper Service implementation to handle stateful H2 connections.
///
diff --git a/proxmox-rest-server/src/lib.rs b/proxmox-rest-server/src/lib.rs
index 43dafa91..38c0d96f 100644
--- a/proxmox-rest-server/src/lib.rs
+++ b/proxmox-rest-server/src/lib.rs
@@ -19,7 +19,7 @@
use std::fmt;
use std::sync::LazyLock;
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use nix::unistd::Pid;
use proxmox_sys::fs::CreateOptions;
diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs
index c11a9b0c..848fbc3a 100644
--- a/proxmox-rest-server/src/rest.rs
+++ b/proxmox-rest-server/src/rest.rs
@@ -7,7 +7,7 @@ use std::pin::Pin;
use std::sync::{Arc, LazyLock, Mutex};
use std::task::{Context, Poll};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use futures::future::FutureExt;
use futures::stream::TryStreamExt;
use hyper::body::HttpBody;
@@ -22,8 +22,8 @@ use tower_service::Service;
use url::form_urlencoded;
use proxmox_router::{
- check_api_permission, ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment,
- RpcEnvironmentType, UserInformation,
+ ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment, RpcEnvironmentType,
+ UserInformation, check_api_permission,
};
use proxmox_router::{http_bail, http_err};
use proxmox_schema::{ObjectSchemaType, ParameterSchema};
@@ -33,7 +33,7 @@ use proxmox_compression::DeflateEncoder;
use proxmox_log::FileLogger;
use crate::{
- formatter::*, normalize_path, ApiConfig, AuthError, CompressionMethod, RestEnvironment,
+ ApiConfig, AuthError, CompressionMethod, RestEnvironment, formatter::*, normalize_path,
};
unsafe extern "C" {
diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs
index 24e2676e..6f0fcab2 100644
--- a/proxmox-rest-server/src/worker_task.rs
+++ b/proxmox-rest-server/src/worker_task.rs
@@ -7,11 +7,11 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, LazyLock, Mutex, OnceLock};
use std::time::{Duration, SystemTime};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use futures::*;
use nix::fcntl::OFlag;
use serde::{Deserialize, Serialize};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tokio::signal::unix::SignalKind;
use tokio::sync::{oneshot, watch};
use tracing::{info, warn};
@@ -20,7 +20,7 @@ use proxmox_daemon::command_socket::CommandSocket;
use proxmox_lang::try_block;
use proxmox_log::{FileLogOptions, FileLogger, LogContext};
use proxmox_schema::upid::UPID;
-use proxmox_sys::fs::{atomic_open_or_create_file, create_path, replace_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, atomic_open_or_create_file, create_path, replace_file};
use proxmox_sys::linux::procfs;
use proxmox_sys::logrotate::{LogRotate, LogRotateFiles};
use proxmox_worker_task::WorkerTaskContext;
diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs
index aa99d528..797687db 100644
--- a/proxmox-router/src/cli/command.rs
+++ b/proxmox-router/src/cli/command.rs
@@ -1,7 +1,7 @@
use std::cell::RefCell;
use std::sync::Arc;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -11,8 +11,8 @@ use proxmox_schema::*;
use super::environment::CliEnvironment;
use super::getopts;
use super::{
- generate_nested_usage, generate_usage_str_do, print_help, print_nested_usage_error,
- print_simple_usage_error_do, CliCommand, CliCommandMap, CommandLineInterface, GlobalOptions,
+ CliCommand, CliCommandMap, CommandLineInterface, GlobalOptions, generate_nested_usage,
+ generate_usage_str_do, print_help, print_nested_usage_error, print_simple_usage_error_do,
};
use crate::{ApiFuture, ApiHandler, ApiMethod, RpcEnvironment};
diff --git a/proxmox-router/src/cli/completion.rs b/proxmox-router/src/cli/completion.rs
index 5a899eec..340be153 100644
--- a/proxmox-router/src/cli/completion.rs
+++ b/proxmox-router/src/cli/completion.rs
@@ -4,7 +4,7 @@ use proxmox_schema::*;
use super::help_command_def;
use super::{
- shellword_split_unclosed, CliCommand, CliCommandMap, CommandLineInterface, CompletionFunction,
+ CliCommand, CliCommandMap, CommandLineInterface, CompletionFunction, shellword_split_unclosed,
};
fn record_done_argument(
diff --git a/proxmox-router/src/cli/completion_helpers.rs b/proxmox-router/src/cli/completion_helpers.rs
index 0e8d178f..3c53c8e3 100644
--- a/proxmox-router/src/cli/completion_helpers.rs
+++ b/proxmox-router/src/cli/completion_helpers.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use nix::dir::Dir;
use nix::fcntl::{AtFlags, OFlag};
-use nix::sys::stat::{fstatat, Mode};
+use nix::sys::stat::{Mode, fstatat};
pub fn complete_file_name(arg: &str, _param: &HashMap<String, String>) -> Vec<String> {
let mut result = vec![];
diff --git a/proxmox-router/src/cli/format.rs b/proxmox-router/src/cli/format.rs
index 95448aa9..adeaf571 100644
--- a/proxmox-router/src/cli/format.rs
+++ b/proxmox-router/src/cli/format.rs
@@ -2,17 +2,17 @@
use std::collections::{HashMap, HashSet};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::Serialize;
use serde_json::Value;
use proxmox_schema::format::{
- get_property_description, get_schema_type_text, DocumentationFormat, ParameterDisplayStyle,
+ DocumentationFormat, ParameterDisplayStyle, get_property_description, get_schema_type_text,
};
use proxmox_schema::*;
-use super::{value_to_text, TableFormatOptions};
use super::{CliCommand, CliCommandMap, CommandLineInterface, GlobalOptions};
+use super::{TableFormatOptions, value_to_text};
/// Helper function to format and print result.
///
diff --git a/proxmox-router/src/cli/mod.rs b/proxmox-router/src/cli/mod.rs
index 2393da31..7060bcba 100644
--- a/proxmox-router/src/cli/mod.rs
+++ b/proxmox-router/src/cli/mod.rs
@@ -17,7 +17,7 @@ use std::collections::HashMap;
use std::io::{self, Write};
use std::sync::Arc;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::Deserialize;
use serde_json::Value;
diff --git a/proxmox-router/src/cli/shellword.rs b/proxmox-router/src/cli/shellword.rs
index dd7584f0..68493f66 100644
--- a/proxmox-router/src/cli/shellword.rs
+++ b/proxmox-router/src/cli/shellword.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
/// Shell quote type
pub use rustyline::completion::Quote;
diff --git a/proxmox-router/src/cli/text_table.rs b/proxmox-router/src/cli/text_table.rs
index 34173b4d..40b76d9f 100644
--- a/proxmox-router/src/cli/text_table.rs
+++ b/proxmox-router/src/cli/text_table.rs
@@ -1,6 +1,6 @@
use std::io::{IsTerminal, Write};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde_json::Value;
use unicode_width::UnicodeWidthStr;
diff --git a/proxmox-router/src/error.rs b/proxmox-router/src/error.rs
index 15c5417f..69955507 100644
--- a/proxmox-router/src/error.rs
+++ b/proxmox-router/src/error.rs
@@ -1,4 +1,4 @@
-pub use proxmox_http_error::{http_bail, http_err, HttpError};
+pub use proxmox_http_error::{HttpError, http_bail, http_err};
#[doc(hidden)]
pub use http::StatusCode;
diff --git a/proxmox-router/src/format.rs b/proxmox-router/src/format.rs
index 67568af0..4eabb9e3 100644
--- a/proxmox-router/src/format.rs
+++ b/proxmox-router/src/format.rs
@@ -4,8 +4,8 @@ use std::io::Write;
use anyhow::Error;
-use proxmox_schema::format::*;
use proxmox_schema::ObjectSchemaType;
+use proxmox_schema::format::*;
#[cfg(feature = "server")]
use crate::ApiHandler;
diff --git a/proxmox-router/src/permission.rs b/proxmox-router/src/permission.rs
index f6388d64..102f6d94 100644
--- a/proxmox-router/src/permission.rs
+++ b/proxmox-router/src/permission.rs
@@ -200,7 +200,7 @@ fn check_api_permission_tail(
#[cfg(test)]
mod test {
- use serde_json::{json, Value};
+ use serde_json::{Value, json};
use crate::permission::*;
diff --git a/proxmox-router/src/router.rs b/proxmox-router/src/router.rs
index 33b598da..cc38d9d5 100644
--- a/proxmox-router/src/router.rs
+++ b/proxmox-router/src/router.rs
@@ -42,10 +42,12 @@ use crate::SerializableReturn;
/// &ObjectSchema::new("Hello World Example", &[])
/// );
/// ```
-pub type ApiHandlerFn = &'static (dyn Fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result<Value, Error>
- + Send
- + Sync
- + 'static);
+pub type ApiHandlerFn = &'static (
+ dyn Fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result<Value, Error>
+ + Send
+ + Sync
+ + 'static
+ );
/// A synchronous API handler gets a json Value as input and returns a serializable return value as output.
///
@@ -69,14 +71,16 @@ pub type ApiHandlerFn = &'static (dyn Fn(Value, &ApiMethod, &mut dyn RpcEnvironm
/// &ObjectSchema::new("Hello World Example", &[])
/// );
/// ```
-pub type SerializingApiHandlerFn = &'static (dyn Fn(
+pub type SerializingApiHandlerFn = &'static (
+ dyn Fn(
Value,
&ApiMethod,
&mut dyn RpcEnvironment,
) -> Result<Box<dyn SerializableReturn + Send>, Error>
- + Send
- + Sync
- + 'static);
+ + Send
+ + Sync
+ + 'static
+ );
/// A record for a streaming API call. This contains a `Result<Value, Error>` and allows formatting
/// as a `json-seq` formatted string.
@@ -181,10 +185,12 @@ where
/// &ObjectSchema::new("Hello World Example", &[])
/// );
/// ```
-pub type StreamApiHandlerFn = &'static (dyn Fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result<SyncStream, Error>
- + Send
- + Sync
- + 'static);
+pub type StreamApiHandlerFn = &'static (
+ dyn Fn(Value, &ApiMethod, &mut dyn RpcEnvironment) -> Result<SyncStream, Error>
+ + Send
+ + Sync
+ + 'static
+ );
pub struct SyncStream {
inner: Box<dyn Iterator<Item = Record> + Send>,
@@ -244,9 +250,11 @@ where
/// &ObjectSchema::new("Hello World Example (async)", &[])
/// );
/// ```
-pub type ApiAsyncHandlerFn = &'static (dyn for<'a> Fn(Value, &'static ApiMethod, &'a mut dyn RpcEnvironment) -> ApiFuture<'a>
- + Send
- + Sync);
+pub type ApiAsyncHandlerFn = &'static (
+ dyn for<'a> Fn(Value, &'static ApiMethod, &'a mut dyn RpcEnvironment) -> ApiFuture<'a>
+ + Send
+ + Sync
+ );
pub type ApiFuture<'a> = Pin<Box<dyn Future<Output = Result<Value, anyhow::Error>> + Send + 'a>>;
@@ -276,13 +284,15 @@ pub type ApiFuture<'a> = Pin<Box<dyn Future<Output = Result<Value, anyhow::Error
/// &ObjectSchema::new("Hello World Example (async)", &[])
/// );
/// ```
-pub type SerializingApiAsyncHandlerFn = &'static (dyn for<'a> Fn(
+pub type SerializingApiAsyncHandlerFn = &'static (
+ dyn for<'a> Fn(
Value,
&'static ApiMethod,
&'a mut dyn RpcEnvironment,
) -> SerializingApiFuture<'a>
- + Send
- + Sync);
+ + Send
+ + Sync
+ );
pub type SerializingApiFuture<'a> = Pin<
Box<dyn Future<Output = Result<Box<dyn SerializableReturn + Send>, anyhow::Error>> + Send + 'a>,
@@ -319,13 +329,15 @@ pub type SerializingApiFuture<'a> = Pin<
/// &ObjectSchema::new("Hello World Example (async)", &[])
/// );
/// ```
-pub type StreamApiAsyncHandlerFn = &'static (dyn for<'a> Fn(
+pub type StreamApiAsyncHandlerFn = &'static (
+ dyn for<'a> Fn(
Value,
&'static ApiMethod,
&'a mut dyn RpcEnvironment,
) -> StreamApiFuture<'a>
- + Send
- + Sync);
+ + Send
+ + Sync
+ );
pub type StreamApiFuture<'a> =
Pin<Box<dyn Future<Output = Result<Stream, anyhow::Error>> + Send + 'a>>;
@@ -419,16 +431,18 @@ impl IntoRecord for Result<Record, Error> {
/// );
/// ```
#[cfg(feature = "server")]
-pub type ApiAsyncHttpHandlerFn = &'static (dyn Fn(
+pub type ApiAsyncHttpHandlerFn = &'static (
+ dyn Fn(
Parts,
Body,
Value,
&'static ApiMethod,
Box<dyn RpcEnvironment>,
) -> ApiResponseFuture
- + Send
- + Sync
- + 'static);
+ + Send
+ + Sync
+ + 'static
+ );
/// The output of an asynchronous API handler is a future yielding a `Response`.
#[cfg(feature = "server")]
diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs
index 782c18a6..236edb2a 100644
--- a/proxmox-router/src/stream/parsing.rs
+++ b/proxmox-router/src/stream/parsing.rs
@@ -1,9 +1,9 @@
use std::future::Future;
use std::io;
use std::pin::Pin;
-use std::task::{ready, Poll};
+use std::task::{Poll, ready};
-use anyhow::{format_err, Context as _, Error};
+use anyhow::{Context as _, Error, format_err};
use futures::io::{AsyncBufRead, AsyncBufReadExt, AsyncRead, BufReader};
use hyper::body::{Body, Bytes};
use serde::Deserialize;
diff --git a/proxmox-rrd/examples/prrd.rs b/proxmox-rrd/examples/prrd.rs
index c2a3789b..859fe981 100644
--- a/proxmox-rrd/examples/prrd.rs
+++ b/proxmox-rrd/examples/prrd.rs
@@ -2,15 +2,15 @@
use std::path::PathBuf;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
use serde_json::json;
-use proxmox_router::cli::{
- complete_file_name, run_cli_command, CliCommand, CliCommandMap, CliEnvironment,
-};
use proxmox_router::RpcEnvironment;
-use proxmox_schema::{api, ApiStringFormat, ApiType, IntegerSchema, Schema, StringSchema};
+use proxmox_router::cli::{
+ CliCommand, CliCommandMap, CliEnvironment, complete_file_name, run_cli_command,
+};
+use proxmox_schema::{ApiStringFormat, ApiType, IntegerSchema, Schema, StringSchema, api};
use proxmox_sys::fs::CreateOptions;
diff --git a/proxmox-rrd/src/cache.rs b/proxmox-rrd/src/cache.rs
index 9dd85a16..e1c574c8 100644
--- a/proxmox-rrd/src/cache.rs
+++ b/proxmox-rrd/src/cache.rs
@@ -7,13 +7,13 @@ use std::sync::{Arc, RwLock};
use std::thread::spawn;
use std::time::SystemTime;
-use anyhow::{bail, format_err, Error};
-use crossbeam_channel::{bounded, TryRecvError};
+use anyhow::{Error, bail, format_err};
+use crossbeam_channel::{TryRecvError, bounded};
-use proxmox_sys::fs::{create_path, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, create_path};
-use crate::rrd::{AggregationFn, DataSourceType, Database};
use crate::Entry;
+use crate::rrd::{AggregationFn, DataSourceType, Database};
mod journal;
use journal::*;
diff --git a/proxmox-rrd/src/cache/journal.rs b/proxmox-rrd/src/cache/journal.rs
index c196b342..67796a46 100644
--- a/proxmox-rrd/src/cache/journal.rs
+++ b/proxmox-rrd/src/cache/journal.rs
@@ -6,7 +6,7 @@ use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use crossbeam_channel::Receiver;
use nix::fcntl::OFlag;
diff --git a/proxmox-rrd/src/cache/rrd_map.rs b/proxmox-rrd/src/cache/rrd_map.rs
index 0ef61cfa..9fa0d44e 100644
--- a/proxmox-rrd/src/cache/rrd_map.rs
+++ b/proxmox-rrd/src/cache/rrd_map.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::path::Path;
use std::sync::Arc;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_sys::fs::create_path;
diff --git a/proxmox-rrd/src/rrd.rs b/proxmox-rrd/src/rrd.rs
index 440abe06..c6f8b240 100644
--- a/proxmox-rrd/src/rrd.rs
+++ b/proxmox-rrd/src/rrd.rs
@@ -15,11 +15,11 @@ use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd};
use std::path::Path;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
use proxmox_schema::api;
-use proxmox_sys::fs::{make_tmp_file, CreateOptions};
+use proxmox_sys::fs::{CreateOptions, make_tmp_file};
/// Proxmox RRD v2 file magic number
// openssl::sha::sha256(b"Proxmox Round Robin Database file v2.0")[0..8];
diff --git a/proxmox-rrd/tests/file_format_test.rs b/proxmox-rrd/tests/file_format_test.rs
index c505f829..1c2ded85 100644
--- a/proxmox-rrd/tests/file_format_test.rs
+++ b/proxmox-rrd/tests/file_format_test.rs
@@ -1,7 +1,7 @@
use std::path::Path;
use std::process::Command;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_rrd::rrd::Database;
use proxmox_sys::fs::CreateOptions;
diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index eca835e3..a2e84891 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -17,9 +17,9 @@ pub mod verify;
pub use extract::ExtractValueDeserializer;
-use cow3::{str_slice_to_range, Cow3};
+use cow3::{Cow3, str_slice_to_range};
-pub use no_schema::{split_list, SplitList};
+pub use no_schema::{SplitList, split_list};
// Used to disable calling `check_constraints` on a `StringSchema` if it is being deserialized
// for a `PropertyString`, which performs its own checking.
@@ -645,7 +645,7 @@ impl<'de> de::MapAccess<'de> for MapAccess<'de, '_> {
None => {
return Err(Error::msg(
"value without key, but schema does not define a default key",
- ))
+ ));
}
},
};
diff --git a/proxmox-schema/src/de/no_schema.rs b/proxmox-schema/src/de/no_schema.rs
index 747ef44a..f5bf6c2e 100644
--- a/proxmox-schema/src/de/no_schema.rs
+++ b/proxmox-schema/src/de/no_schema.rs
@@ -4,8 +4,8 @@ use std::borrow::Cow;
use serde::de;
-use super::cow3::Cow3;
use super::Error;
+use super::cow3::Cow3;
/// This can only deserialize strings and lists of strings and has no schema.
pub struct NoSchemaDeserializer<'de, 'i> {
diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs
index c1e33a68..6a8ebdd5 100644
--- a/proxmox-schema/src/format.rs
+++ b/proxmox-schema/src/format.rs
@@ -1,6 +1,6 @@
//! Module to generate and format API Documentation
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use crate::*;
diff --git a/proxmox-schema/src/property_string.rs b/proxmox-schema/src/property_string.rs
index 01b5727a..85660172 100644
--- a/proxmox-schema/src/property_string.rs
+++ b/proxmox-schema/src/property_string.rs
@@ -196,14 +196,18 @@ fn iterate_over_property_string() {
);
assert!(iter.next().is_none());
- assert!(PropertyIterator::new(r#"key="open \\ value"#)
- .next()
- .unwrap()
- .is_err());
- assert!(PropertyIterator::new(r#"key="open \\ value\""#)
- .next()
- .unwrap()
- .is_err());
+ assert!(
+ PropertyIterator::new(r#"key="open \\ value"#)
+ .next()
+ .unwrap()
+ .is_err()
+ );
+ assert!(
+ PropertyIterator::new(r#"key="open \\ value\""#)
+ .next()
+ .unwrap()
+ .is_err()
+ );
}
/// A wrapper for a de/serializable type which is stored as a property string.
@@ -267,7 +271,7 @@ where
where
D: serde::Deserializer<'de>,
{
- use crate::de::{set_in_property_string, InPropertyStringGuard};
+ use crate::de::{InPropertyStringGuard, set_in_property_string};
use std::marker::PhantomData;
diff --git a/proxmox-schema/src/schema.rs b/proxmox-schema/src/schema.rs
index df87e070..393ceca2 100644
--- a/proxmox-schema/src/schema.rs
+++ b/proxmox-schema/src/schema.rs
@@ -7,8 +7,8 @@
use std::collections::HashSet;
use std::fmt;
-use anyhow::{bail, format_err, Error};
-use serde_json::{json, Value};
+use anyhow::{Error, bail, format_err};
+use serde_json::{Value, json};
use crate::ConstRegexPattern;
diff --git a/proxmox-schema/src/upid.rs b/proxmox-schema/src/upid.rs
index 9bbb66a1..bbd4b0b3 100644
--- a/proxmox-schema/src/upid.rs
+++ b/proxmox-schema/src/upid.rs
@@ -1,6 +1,6 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
-use crate::{const_regex, ApiStringFormat, ApiType, Schema, StringSchema};
+use crate::{ApiStringFormat, ApiType, Schema, StringSchema, const_regex};
/// Unique Process/Task Identifier
///
@@ -212,7 +212,7 @@ mod upid_impl {
use std::os::unix::ffi::OsStrExt;
use std::sync::atomic::{AtomicUsize, Ordering};
- use anyhow::{bail, format_err, Error};
+ use anyhow::{Error, bail, format_err};
use super::UPID;
diff --git a/proxmox-schema/tests/schema_verification.rs b/proxmox-schema/tests/schema_verification.rs
index 2571a552..d446fa57 100644
--- a/proxmox-schema/tests/schema_verification.rs
+++ b/proxmox-schema/tests/schema_verification.rs
@@ -1,5 +1,5 @@
-use anyhow::{bail, Error};
-use serde_json::{json, Value};
+use anyhow::{Error, bail};
+use serde_json::{Value, json};
use proxmox_schema::*;
diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs
index 1fc74e91..fb844ae3 100644
--- a/proxmox-section-config/src/lib.rs
+++ b/proxmox-section-config/src/lib.rs
@@ -24,13 +24,13 @@ use std::collections::HashMap;
use std::collections::HashSet;
use std::path::Path;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::de::DeserializeOwned;
use serde::ser::Serialize;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use proxmox_lang::try_block;
-use proxmox_schema::format::{dump_properties, wrap_text, ParameterDisplayStyle};
+use proxmox_schema::format::{ParameterDisplayStyle, dump_properties, wrap_text};
use proxmox_schema::*;
pub mod typed;
diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index 31e8e4b2..a1cc5302 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -3,8 +3,8 @@
use std::collections::HashMap;
use anyhow::Error;
-use serde::{de::DeserializeOwned, Serialize};
-use serde_json::{json, Value};
+use serde::{Serialize, de::DeserializeOwned};
+use serde_json::{Value, json};
use crate::SectionConfig;
use crate::SectionConfigData as RawSectionConfigData;
diff --git a/proxmox-sendmail/src/lib.rs b/proxmox-sendmail/src/lib.rs
index 050c3322..1f99c701 100644
--- a/proxmox-sendmail/src/lib.rs
+++ b/proxmox-sendmail/src/lib.rs
@@ -6,8 +6,8 @@
use std::io::Write;
use std::process::{Command, Stdio};
-use anyhow::{bail, Context, Error};
-use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
+use anyhow::{Context, Error, bail};
+use percent_encoding::{AsciiSet, CONTROLS, utf8_percent_encode};
// Characters in this set will be encoded, so reproduce the inverse of the set described by RFC5987
// Section 3.2.1 `attr-char`, as that describes all characters that **don't** need encoding:
diff --git a/proxmox-serde/src/json.rs b/proxmox-serde/src/json.rs
index 63574d33..281114b9 100644
--- a/proxmox-serde/src/json.rs
+++ b/proxmox-serde/src/json.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde_json::Value;
diff --git a/proxmox-shared-cache/src/lib.rs b/proxmox-shared-cache/src/lib.rs
index d0b2148a..893808f5 100644
--- a/proxmox-shared-cache/src/lib.rs
+++ b/proxmox-shared-cache/src/lib.rs
@@ -4,8 +4,8 @@ use std::path::PathBuf;
use std::time::Duration;
use anyhow::Error;
-use serde::de::DeserializeOwned;
use serde::Serialize;
+use serde::de::DeserializeOwned;
use proxmox_sys::fs::CreateOptions;
diff --git a/proxmox-shared-memory/src/lib.rs b/proxmox-shared-memory/src/lib.rs
index 4a986b09..c5f60ddc 100644
--- a/proxmox-shared-memory/src/lib.rs
+++ b/proxmox-shared-memory/src/lib.rs
@@ -8,7 +8,7 @@ use std::os::unix::io::AsRawFd;
use std::os::unix::io::FromRawFd;
use std::path::Path;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::mman::{MapFlags, ProtFlags};
diff --git a/proxmox-shared-memory/src/shared_mutex.rs b/proxmox-shared-memory/src/shared_mutex.rs
index 49adf5e5..90f1aa20 100644
--- a/proxmox-shared-memory/src/shared_mutex.rs
+++ b/proxmox-shared-memory/src/shared_mutex.rs
@@ -3,10 +3,10 @@ use std::marker::PhantomData;
use std::mem::MaybeUninit;
use std::ops::{Deref, DerefMut};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
-use crate::raw_shared_mutex::RawSharedMutex;
use crate::Init;
+use crate::raw_shared_mutex::RawSharedMutex;
#[derive(Debug)]
#[repr(C)]
diff --git a/proxmox-shared-memory/tests/raw_shared_mutex.rs b/proxmox-shared-memory/tests/raw_shared_mutex.rs
index 7608377e..ac54a600 100644
--- a/proxmox-shared-memory/tests/raw_shared_mutex.rs
+++ b/proxmox-shared-memory/tests/raw_shared_mutex.rs
@@ -5,7 +5,7 @@ use anyhow::Error;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
use nix::unistd::mkdir;
-use proxmox_shared_memory::{check_subtype, initialize_subtype, Init, SharedMemory, SharedMutex};
+use proxmox_shared_memory::{Init, SharedMemory, SharedMutex, check_subtype, initialize_subtype};
use proxmox_sys::fs::CreateOptions;
use std::sync::atomic::AtomicU64;
diff --git a/proxmox-simple-config/src/lib.rs b/proxmox-simple-config/src/lib.rs
index 710fb53a..df16d077 100644
--- a/proxmox-simple-config/src/lib.rs
+++ b/proxmox-simple-config/src/lib.rs
@@ -4,7 +4,7 @@
use std::io::Write;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
use serde_json::Value;
diff --git a/proxmox-sortable-macro/src/lib.rs b/proxmox-sortable-macro/src/lib.rs
index 1395c77c..026fadf0 100644
--- a/proxmox-sortable-macro/src/lib.rs
+++ b/proxmox-sortable-macro/src/lib.rs
@@ -9,10 +9,10 @@ use std::mem;
use proc_macro::TokenStream as TokenStream_1;
use proc_macro2::TokenStream;
use quote::quote;
+use syn::Error;
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::visit_mut::VisitMut;
-use syn::Error;
macro_rules! format_err {
($span:expr => $($msg:tt)*) => { Error::new_spanned($span, format!($($msg)*)) };
diff --git a/proxmox-subscription/src/check.rs b/proxmox-subscription/src/check.rs
index 8522bcd3..a098123c 100644
--- a/proxmox-subscription/src/check.rs
+++ b/proxmox-subscription/src/check.rs
@@ -1,15 +1,15 @@
use std::sync::LazyLock;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use regex::Regex;
use serde_json::json;
-use proxmox_http::{uri::json_object_to_query, HttpClient};
+use proxmox_http::{HttpClient, uri::json_object_to_query};
use crate::{
- subscription_info::{md5sum, SHARED_KEY_DATA},
SubscriptionInfo, SubscriptionStatus,
+ subscription_info::{SHARED_KEY_DATA, md5sum},
};
static ATTR_RE: LazyLock<Regex> =
diff --git a/proxmox-subscription/src/files.rs b/proxmox-subscription/src/files.rs
index 37008f4a..28aaa23b 100644
--- a/proxmox-subscription/src/files.rs
+++ b/proxmox-subscription/src/files.rs
@@ -1,11 +1,11 @@
use std::path::Path;
-use anyhow::{format_err, Error};
-use proxmox_sys::fs::{replace_file, CreateOptions};
+use anyhow::{Error, format_err};
+use proxmox_sys::fs::{CreateOptions, replace_file};
use crate::{
- subscription_info::{md5sum, SHARED_KEY_DATA},
SubscriptionInfo, SubscriptionStatus,
+ subscription_info::{SHARED_KEY_DATA, md5sum},
};
pub const DEFAULT_SIGNING_KEY: &str = "/usr/share/keyrings/proxmox-offline-signing-key.pub";
@@ -67,7 +67,7 @@ fn parse_subscription_file(raw: &str) -> Result<Option<SubscriptionInfo>, Error>
status: SubscriptionStatus::Invalid,
message: Some("subscription key mismatch".to_string()),
..info
- }))
+ }));
}
_ => {}
}
diff --git a/proxmox-subscription/src/lib.rs b/proxmox-subscription/src/lib.rs
index 2ed96903..0e88d77c 100644
--- a/proxmox-subscription/src/lib.rs
+++ b/proxmox-subscription/src/lib.rs
@@ -3,7 +3,7 @@
mod subscription_info;
#[cfg(feature = "impl")]
pub use subscription_info::{
- get_hardware_address, ProductType, SubscriptionInfo, SubscriptionStatus,
+ ProductType, SubscriptionInfo, SubscriptionStatus, get_hardware_address,
};
#[cfg(not(feature = "impl"))]
diff --git a/proxmox-subscription/src/sign.rs b/proxmox-subscription/src/sign.rs
index 50ee352b..40118d2f 100644
--- a/proxmox-subscription/src/sign.rs
+++ b/proxmox-subscription/src/sign.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use openssl::{hash::MessageDigest, pkey::Public};
use serde::{Deserialize, Serialize};
diff --git a/proxmox-subscription/src/subscription_info.rs b/proxmox-subscription/src/subscription_info.rs
index f53b3ce3..7f58b50a 100644
--- a/proxmox-subscription/src/subscription_info.rs
+++ b/proxmox-subscription/src/subscription_info.rs
@@ -1,10 +1,10 @@
use std::{fmt::Display, str::FromStr};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use serde::{Deserialize, Serialize};
#[cfg(feature = "api-types")]
-use proxmox_schema::{api, Updater};
+use proxmox_schema::{Updater, api};
// Aliases are needed for PVE compat!
#[cfg_attr(feature = "api-types", api())]
@@ -136,7 +136,7 @@ pub struct SubscriptionInfo {
pub use _impl::get_hardware_address;
#[cfg(feature = "impl")]
-pub(crate) use _impl::{md5sum, SHARED_KEY_DATA};
+pub(crate) use _impl::{SHARED_KEY_DATA, md5sum};
#[cfg(feature = "impl")]
mod _impl {
@@ -144,8 +144,8 @@ mod _impl {
use std::path::Path;
use anyhow::format_err;
- use anyhow::{bail, Error};
- use openssl::hash::{hash, DigestBytes, MessageDigest};
+ use anyhow::{Error, bail};
+ use openssl::hash::{DigestBytes, MessageDigest, hash};
use proxmox_sys::fs::file_get_contents;
use proxmox_time::TmEditor;
diff --git a/proxmox-sys/src/command.rs b/proxmox-sys/src/command.rs
index bc2ff249..e64bd016 100644
--- a/proxmox-sys/src/command.rs
+++ b/proxmox-sys/src/command.rs
@@ -2,7 +2,7 @@
use std::process::{Command, Output};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
/// Helper to check result from [Command] output
///
diff --git a/proxmox-sys/src/crypt.rs b/proxmox-sys/src/crypt.rs
index 508b9c15..24abf9f6 100644
--- a/proxmox-sys/src/crypt.rs
+++ b/proxmox-sys/src/crypt.rs
@@ -5,7 +5,7 @@
use std::ffi::{CStr, CString};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
// from libcrypt1, 'lib/crypt.h.in'
const CRYPT_OUTPUT_SIZE: usize = 384;
diff --git a/proxmox-sys/src/fd.rs b/proxmox-sys/src/fd.rs
index 386e4222..6f50b69a 100644
--- a/proxmox-sys/src/fd.rs
+++ b/proxmox-sys/src/fd.rs
@@ -2,13 +2,13 @@
use std::os::unix::io::AsRawFd;
-use nix::sys::stat::Mode;
use nix::NixPath;
+use nix::sys::stat::Mode;
use nix::{fcntl::OFlag, sys::stat};
use std::os::unix::io::{FromRawFd, OwnedFd, RawFd};
-use nix::fcntl::{fcntl, FdFlag, F_GETFD, F_SETFD};
+use nix::fcntl::{F_GETFD, F_SETFD, FdFlag, fcntl};
/// Change the `O_CLOEXEC` flag of an existing file descriptor.
pub fn fd_change_cloexec(fd: RawFd, on: bool) -> Result<(), anyhow::Error> {
diff --git a/proxmox-sys/src/fs/acl.rs b/proxmox-sys/src/fs/acl.rs
index 29aa75ab..1c69edd8 100644
--- a/proxmox-sys/src/fs/acl.rs
+++ b/proxmox-sys/src/fs/acl.rs
@@ -11,8 +11,8 @@ use std::path::Path;
use std::ptr;
use libc::{c_char, c_int, c_void};
-use nix::errno::Errno;
use nix::NixPath;
+use nix::errno::Errno;
#[rustfmt::skip]
mod constants {
diff --git a/proxmox-sys/src/fs/dir.rs b/proxmox-sys/src/fs/dir.rs
index f8fec3a7..c698a7d1 100644
--- a/proxmox-sys/src/fs/dir.rs
+++ b/proxmox-sys/src/fs/dir.rs
@@ -4,7 +4,7 @@ use std::os::unix::ffi::OsStringExt;
use std::os::unix::io::{AsRawFd, OwnedFd};
use std::path::{Path, PathBuf};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::stat;
@@ -12,7 +12,7 @@ use nix::unistd;
use proxmox_lang::try_block;
-use crate::fs::{fchown, CreateOptions};
+use crate::fs::{CreateOptions, fchown};
/// The default list of [`OFlag`]'s we want to use when opening directories. Besides ensuring that
/// the FD indeed points to a directory we also must ensure that it gets closed on exec to avoid
diff --git a/proxmox-sys/src/fs/file.rs b/proxmox-sys/src/fs/file.rs
index 74b9e74e..497a6dc5 100644
--- a/proxmox-sys/src/fs/file.rs
+++ b/proxmox-sys/src/fs/file.rs
@@ -5,12 +5,12 @@ use std::path::{Path, PathBuf};
#[cfg(feature = "timer")]
use std::time::Duration;
-use anyhow::{bail, format_err, Context as _, Error};
+use anyhow::{Context as _, Error, bail, format_err};
+use nix::NixPath;
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::stat;
use nix::unistd;
-use nix::NixPath;
use serde_json::Value;
use crate::error::SysError;
diff --git a/proxmox-sys/src/fs/mod.rs b/proxmox-sys/src/fs/mod.rs
index 752b75d2..6cda6326 100644
--- a/proxmox-sys/src/fs/mod.rs
+++ b/proxmox-sys/src/fs/mod.rs
@@ -1,7 +1,7 @@
//! File system related utilities
use std::path::Path;
-use anyhow::{bail, Context, Error};
+use anyhow::{Context, Error, bail};
use nix::sys::stat;
use nix::unistd::{Gid, Uid};
diff --git a/proxmox-sys/src/fs/read_dir.rs b/proxmox-sys/src/fs/read_dir.rs
index 09dbac3d..2d6fe52e 100644
--- a/proxmox-sys/src/fs/read_dir.rs
+++ b/proxmox-sys/src/fs/read_dir.rs
@@ -2,7 +2,7 @@ use std::borrow::{Borrow, BorrowMut};
use std::ops::{Deref, DerefMut};
use std::os::unix::io::{AsRawFd, RawFd};
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use nix::dir;
use nix::dir::Dir;
use nix::fcntl::OFlag;
diff --git a/proxmox-sys/src/linux/mod.rs b/proxmox-sys/src/linux/mod.rs
index b6efddbb..cfc85757 100644
--- a/proxmox-sys/src/linux/mod.rs
+++ b/proxmox-sys/src/linux/mod.rs
@@ -1,6 +1,6 @@
//! Linux specific helpers and syscall wrapper
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use proxmox_io::vec;
diff --git a/proxmox-sys/src/linux/pid.rs b/proxmox-sys/src/linux/pid.rs
index 03464551..020cb3d1 100644
--- a/proxmox-sys/src/linux/pid.rs
+++ b/proxmox-sys/src/linux/pid.rs
@@ -4,12 +4,12 @@ use std::fs::File;
use std::io;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
+use nix::NixPath;
use nix::fcntl::OFlag;
use nix::sys::signal::Signal;
use nix::sys::signalfd::siginfo;
use nix::sys::stat::Mode;
use nix::unistd::Pid;
-use nix::NixPath;
use crate::error::SysResult;
use crate::linux::procfs::{MountInfo, PidStat};
diff --git a/proxmox-sys/src/linux/procfs/mod.rs b/proxmox-sys/src/linux/procfs/mod.rs
index a1758bc0..a9664cbd 100644
--- a/proxmox-sys/src/linux/procfs/mod.rs
+++ b/proxmox-sys/src/linux/procfs/mod.rs
@@ -8,7 +8,7 @@ use std::str::FromStr;
use std::sync::{LazyLock, RwLock};
use std::time::Instant;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use nix::unistd::Pid;
use serde::Serialize;
diff --git a/proxmox-sys/src/linux/procfs/mountinfo.rs b/proxmox-sys/src/linux/procfs/mountinfo.rs
index ab449c6a..cd3a89e3 100644
--- a/proxmox-sys/src/linux/procfs/mountinfo.rs
+++ b/proxmox-sys/src/linux/procfs/mountinfo.rs
@@ -6,7 +6,7 @@ use std::os::unix::ffi::OsStrExt;
use std::path::PathBuf;
use std::str::FromStr;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use nix::sys::stat;
use nix::unistd::Pid;
diff --git a/proxmox-sys/src/linux/tty.rs b/proxmox-sys/src/linux/tty.rs
index d08ae81f..54ce1409 100644
--- a/proxmox-sys/src/linux/tty.rs
+++ b/proxmox-sys/src/linux/tty.rs
@@ -2,7 +2,7 @@ use std::io::{self, IsTerminal, Read, Write};
use std::mem::MaybeUninit;
use std::os::unix::io::{AsRawFd, OwnedFd};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
diff --git a/proxmox-sys/src/logrotate.rs b/proxmox-sys/src/logrotate.rs
index 704a18ce..8759325c 100644
--- a/proxmox-sys/src/logrotate.rs
+++ b/proxmox-sys/src/logrotate.rs
@@ -1,14 +1,14 @@
//! Log rotation helper
-use std::fs::{rename, File};
+use std::fs::{File, rename};
use std::io::Read;
use std::os::unix::io::{FromRawFd, IntoRawFd};
use std::path::{Path, PathBuf};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use nix::unistd;
-use crate::fs::{make_tmp_file, CreateOptions};
+use crate::fs::{CreateOptions, make_tmp_file};
/// Used for rotating log files and iterating over them
pub struct LogRotate {
diff --git a/proxmox-sys/src/macros.rs b/proxmox-sys/src/macros.rs
index a76db90f..1838acf3 100644
--- a/proxmox-sys/src/macros.rs
+++ b/proxmox-sys/src/macros.rs
@@ -16,7 +16,5 @@ macro_rules! c_result {
/// doing `c_result!(expr)?` (note the question mark).
#[macro_export]
macro_rules! c_try {
- ($expr:expr) => {{
- $crate::c_result!($expr)?
- }};
+ ($expr:expr) => {{ $crate::c_result!($expr)? }};
}
diff --git a/proxmox-sys/src/process_locker.rs b/proxmox-sys/src/process_locker.rs
index 65d2793a..9ea4b554 100644
--- a/proxmox-sys/src/process_locker.rs
+++ b/proxmox-sys/src/process_locker.rs
@@ -11,7 +11,7 @@ use std::collections::HashMap;
use std::os::unix::io::AsRawFd;
use std::sync::{Arc, Mutex};
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
// fixme: use F_OFD_ locks when implemented with nix::fcntl
diff --git a/proxmox-sys/src/systemd.rs b/proxmox-sys/src/systemd.rs
index 43dc5185..002b27a9 100644
--- a/proxmox-sys/src/systemd.rs
+++ b/proxmox-sys/src/systemd.rs
@@ -2,7 +2,7 @@ use std::ffi::OsString;
use std::os::unix::ffi::OsStringExt;
use std::path::PathBuf;
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
#[allow(clippy::manual_range_contains)]
fn parse_hex_digit(d: u8) -> Result<u8, Error> {
diff --git a/proxmox-systemd/src/journal.rs b/proxmox-systemd/src/journal.rs
index 7fbdcaa3..9dce623f 100644
--- a/proxmox-systemd/src/journal.rs
+++ b/proxmox-systemd/src/journal.rs
@@ -1,4 +1,4 @@
-use std::ffi::{c_int, CString, OsStr};
+use std::ffi::{CString, OsStr, c_int};
use std::io;
use std::os::fd::{FromRawFd, OwnedFd};
use std::os::unix::ffi::OsStrExt;
diff --git a/proxmox-systemd/src/lib.rs b/proxmox-systemd/src/lib.rs
index 456d88c3..d7d270bc 100644
--- a/proxmox-systemd/src/lib.rs
+++ b/proxmox-systemd/src/lib.rs
@@ -3,7 +3,7 @@
pub(crate) mod sys;
mod escape;
-pub use escape::{escape_unit, unescape_unit, unescape_unit_path, UnescapeError};
+pub use escape::{UnescapeError, escape_unit, unescape_unit, unescape_unit_path};
pub mod journal;
pub mod notify;
diff --git a/proxmox-systemd/src/notify.rs b/proxmox-systemd/src/notify.rs
index 1c2651b3..4641829d 100644
--- a/proxmox-systemd/src/notify.rs
+++ b/proxmox-systemd/src/notify.rs
@@ -1,4 +1,4 @@
-use std::ffi::{c_char, c_void, CStr, CString};
+use std::ffi::{CStr, CString, c_char, c_void};
use std::io;
use std::os::fd::{AsFd, AsRawFd, RawFd};
diff --git a/proxmox-tfa/src/api/methods.rs b/proxmox-tfa/src/api/methods.rs
index 03dd8b4b..e60a8f65 100644
--- a/proxmox-tfa/src/api/methods.rs
+++ b/proxmox-tfa/src/api/methods.rs
@@ -3,7 +3,7 @@
//! This defines the methods & types used in the authentication and TFA configuration API between
//! PBS, PVE, PMG.
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use super::{OpenUserChallengeData, TfaConfig, TfaInfo, TfaUserData};
use crate::totp::Totp;
diff --git a/proxmox-tfa/src/api/mod.rs b/proxmox-tfa/src/api/mod.rs
index d7f37771..d2732c67 100644
--- a/proxmox-tfa/src/api/mod.rs
+++ b/proxmox-tfa/src/api/mod.rs
@@ -7,12 +7,12 @@
use std::collections::HashMap;
use std::fmt;
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use url::Url;
-use webauthn_rs::{proto::UserVerificationPolicy, Webauthn};
+use webauthn_rs::{Webauthn, proto::UserVerificationPolicy};
use crate::totp::Totp;
use crate::types::bool_is_false;
@@ -1208,11 +1208,11 @@ impl<'de> Deserialize<'de> for TotpEntry {
"totp" if totp.is_some() => return Err(A::Error::duplicate_field("totp")),
"totp" => totp = Some(map.next_value()?),
"last-count" if last_count.is_some() => {
- return Err(A::Error::duplicate_field("last-count"))
+ return Err(A::Error::duplicate_field("last-count"));
}
"last-count" => last_count = Some(map.next_value()?),
other => {
- return Err(A::Error::unknown_field(other, &["totp", "last-count"]))
+ return Err(A::Error::unknown_field(other, &["totp", "last-count"]));
}
}
}
diff --git a/proxmox-tfa/src/api/recovery.rs b/proxmox-tfa/src/api/recovery.rs
index 9629d6ff..7a40c412 100644
--- a/proxmox-tfa/src/api/recovery.rs
+++ b/proxmox-tfa/src/api/recovery.rs
@@ -1,6 +1,6 @@
use std::io;
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use openssl::hash::MessageDigest;
use openssl::pkey::PKey;
use openssl::sign::Signer;
diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs
index 1793df97..70e95ec6 100644
--- a/proxmox-tfa/src/api/webauthn.rs
+++ b/proxmox-tfa/src/api/webauthn.rs
@@ -1,12 +1,12 @@
//! Webauthn configuration and challenge data.
-use anyhow::{format_err, Error};
+use anyhow::{Error, format_err};
use serde::{Deserialize, Serialize};
use url::Url;
use webauthn_rs::proto::{COSEKey, Credential, CredentialID, UserVerificationPolicy};
#[cfg(feature = "api-types")]
-use proxmox_schema::{api, Updater, UpdaterType};
+use proxmox_schema::{Updater, UpdaterType, api};
use super::IsExpired;
diff --git a/proxmox-tfa/src/totp.rs b/proxmox-tfa/src/totp.rs
index 940af542..d880fe93 100644
--- a/proxmox-tfa/src/totp.rs
+++ b/proxmox-tfa/src/totp.rs
@@ -8,7 +8,7 @@ use std::time::{Duration, SystemTime};
use openssl::hash::MessageDigest;
use openssl::pkey::PKey;
use openssl::sign::Signer;
-use percent_encoding::{percent_decode, percent_encode, PercentDecode};
+use percent_encoding::{PercentDecode, percent_decode, percent_encode};
use serde::{Serialize, Serializer};
/// An error from the TOTP TFA submodule.
@@ -352,7 +352,7 @@ impl Totp {
None => {
return Err(Error::msg(
"cannot create otpauth uri without an account name",
- ))
+ ));
}
};
@@ -647,7 +647,9 @@ fn test_algorithm_parsing() {
let period = 30;
let digits = 6;
let issuer = "ISSUER";
- let uri = format!("otpauth://totp/user%40hostname?secret={secret}&issuer={issuer}&algorithm=sha1&digits={digits}&period={period}");
+ let uri = format!(
+ "otpauth://totp/user%40hostname?secret={secret}&issuer={issuer}&algorithm=sha1&digits={digits}&period={period}"
+ );
let hotp: Totp = uri.parse().expect("failed to parse otp uri");
assert_eq!(hotp.algorithm, Algorithm::Sha1);
diff --git a/proxmox-tfa/src/u2f.rs b/proxmox-tfa/src/u2f.rs
index ffd7d64c..2f00120b 100644
--- a/proxmox-tfa/src/u2f.rs
+++ b/proxmox-tfa/src/u2f.rs
@@ -514,8 +514,7 @@ mod test {
const TEST_APPID: &str = "https://u2ftest.enonet.errno.eu";
- const TEST_REGISTRATION_JSON: &str =
- "{\"challenge\":\"mZoWLngnAh8p98nPkFOIBXecd0CbmgEx5tEd5jNswgY\",\"response\":{\"client\
+ const TEST_REGISTRATION_JSON: &str = "{\"challenge\":\"mZoWLngnAh8p98nPkFOIBXecd0CbmgEx5tEd5jNswgY\",\"response\":{\"client\
Data\":\"eyJjaGFsbGVuZ2UiOiJtWm9XTG5nbkFoOHA5OG5Qa0ZPSUJYZWNkMENibWdFeDV0RWQ1ak5zd2dZI\
iwib3JpZ2luIjoiaHR0cHM6Ly91MmZ0ZXN0LmVub25ldC5lcnJuby5ldSIsInR5cCI6Im5hdmlnYXRvci5pZC5\
maW5pc2hFbnJvbGxtZW50In0\",\"registrationData\":\"BQR_9TmMowVeoAHp3ABljCa90eNG87t76D4W\
@@ -533,8 +532,7 @@ mod test {
SbtOrrwswjOKEzwp6EonkCIFBxbLAmwUnblAWOVELASi610ZfPK-7qx2VwkWfHqnll\",\"version\":\"U2F\
_V2\"}}";
- const TEST_AUTH_JSON: &str =
- "{\"challenge\":\"8LE_-7Rd1vB3Otn3vJ7GyiwRQtYPMv-BWliCejH0d4Y\",\"response\":{\"clientD\
+ const TEST_AUTH_JSON: &str = "{\"challenge\":\"8LE_-7Rd1vB3Otn3vJ7GyiwRQtYPMv-BWliCejH0d4Y\",\"response\":{\"clientD\
ata\":\"eyJjaGFsbGVuZ2UiOiI4TEVfLTdSZDF2QjNPdG4zdko3R3lpd1JRdFlQTXYtQldsaUNlakgwZDRZIiw\
ib3JpZ2luIjoiaHR0cHM6Ly91MmZ0ZXN0LmVub25ldC5lcnJuby5ldSIsInR5cCI6Im5hdmlnYXRvci5pZC5nZX\
RBc3NlcnRpb24ifQ\",\"keyHandle\":\"eW3zVxEF8gPsG8eT9cgllzmSzkPdHVlXXV8m52ncX6KL8pJ1loVv\
diff --git a/proxmox-time-api/src/time_impl.rs b/proxmox-time-api/src/time_impl.rs
index a548c717..8fc7e3ec 100644
--- a/proxmox-time-api/src/time_impl.rs
+++ b/proxmox-time-api/src/time_impl.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
use proxmox_product_config::replace_system_config;
use proxmox_sys::fs::file_read_firstline;
diff --git a/proxmox-time/src/calendar_event.rs b/proxmox-time/src/calendar_event.rs
index 696a11a2..22a4b340 100644
--- a/proxmox-time/src/calendar_event.rs
+++ b/proxmox-time/src/calendar_event.rs
@@ -9,8 +9,8 @@ use nom::{
};
use crate::date_time_value::DateTimeValue;
-use crate::parse_helpers::{parse_complete_line, parse_error, parse_time_comp, IResult};
-use crate::{parse_weekdays_range, WeekDays};
+use crate::parse_helpers::{IResult, parse_complete_line, parse_error, parse_time_comp};
+use crate::{WeekDays, parse_weekdays_range};
/// Calendar events may be used to refer to one or more points in time in a
/// single expression. They are designed after the systemd.time Calendar Events
diff --git a/proxmox-time/src/daily_duration.rs b/proxmox-time/src/daily_duration.rs
index adcbc637..df24b42c 100644
--- a/proxmox-time/src/daily_duration.rs
+++ b/proxmox-time/src/daily_duration.rs
@@ -5,8 +5,8 @@ use nom::{
bytes::complete::tag, character::complete::space0, error::context, multi::separated_list1,
};
-use crate::parse_helpers::{parse_complete_line, parse_error, parse_hm_time, IResult};
-use crate::{parse_weekdays_range, WeekDays};
+use crate::parse_helpers::{IResult, parse_complete_line, parse_error, parse_hm_time};
+use crate::{WeekDays, parse_weekdays_range};
#[cfg(not(target_arch = "wasm32"))]
use crate::TmEditor;
@@ -127,7 +127,7 @@ fn parse_daily_duration_incomplete(mut i: &str) -> IResult<&str, DailyDuration>
#[cfg(test)]
mod test {
- use anyhow::{bail, Error};
+ use anyhow::{Error, bail};
use super::*;
diff --git a/proxmox-time/src/parse_helpers.rs b/proxmox-time/src/parse_helpers.rs
index 94d077f9..8afa8ccf 100644
--- a/proxmox-time/src/parse_helpers.rs
+++ b/proxmox-time/src/parse_helpers.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use super::daily_duration::*;
diff --git a/proxmox-time/src/posix.rs b/proxmox-time/src/posix.rs
index c8064bf4..ee555bb1 100644
--- a/proxmox-time/src/posix.rs
+++ b/proxmox-time/src/posix.rs
@@ -2,7 +2,7 @@
use std::ffi::{CStr, CString};
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
/// Safe bindings to libc timelocal
///
diff --git a/proxmox-time/src/test.rs b/proxmox-time/src/test.rs
index d7e86c30..dae818a6 100644
--- a/proxmox-time/src/test.rs
+++ b/proxmox-time/src/test.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
use super::*;
diff --git a/proxmox-time/src/time_span.rs b/proxmox-time/src/time_span.rs
index 6081a534..5b6b30ef 100644
--- a/proxmox-time/src/time_span.rs
+++ b/proxmox-time/src/time_span.rs
@@ -44,7 +44,7 @@ use std::sync::LazyLock;
use anyhow::Error;
use nom::{bytes::complete::take_while1, character::complete::space0, combinator::opt};
-use crate::parse_helpers::{parse_complete_line, parse_error, parse_u64, IResult};
+use crate::parse_helpers::{IResult, parse_complete_line, parse_error, parse_u64};
static TIME_SPAN_UNITS: LazyLock<HashMap<&'static str, f64>> = LazyLock::new(|| {
let mut map = HashMap::new();
diff --git a/proxmox-time/src/wasm.rs b/proxmox-time/src/wasm.rs
index c85f2a10..38ddd316 100644
--- a/proxmox-time/src/wasm.rs
+++ b/proxmox-time/src/wasm.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Error};
+use anyhow::{Error, bail, format_err};
/// Returns Unix Epoch (now)
pub fn epoch_i64() -> i64 {
diff --git a/proxmox-time/src/week_days.rs b/proxmox-time/src/week_days.rs
index c409d292..3948ff5c 100644
--- a/proxmox-time/src/week_days.rs
+++ b/proxmox-time/src/week_days.rs
@@ -1,7 +1,7 @@
use bitflags::bitflags;
use nom::{bytes::complete::tag, character::complete::alpha1, combinator::opt, sequence::pair};
-use crate::parse_helpers::{parse_error, IResult};
+use crate::parse_helpers::{IResult, parse_error};
bitflags! {
/// Defines one or more days of a week.
diff --git a/proxmox-uuid/src/lib.rs b/proxmox-uuid/src/lib.rs
index 09a70b49..968f3878 100644
--- a/proxmox-uuid/src/lib.rs
+++ b/proxmox-uuid/src/lib.rs
@@ -61,7 +61,7 @@ pub struct Uuid(Box<[u8; 16]>);
impl Uuid {
/// Generate a uuid with `uuid_generate(3)`.
pub fn generate() -> Self {
- use std::alloc::{alloc, Layout};
+ use std::alloc::{Layout, alloc};
let uuid = unsafe { alloc(Layout::new::<[u8; 16]>()) as *mut [u8; 16] };
unsafe { uuid_generate(uuid) };
Self(unsafe { Box::from_raw(uuid) })
@@ -92,7 +92,7 @@ impl Uuid {
/// assert_eq!(uuid1, uuid2);
/// ```
pub fn parse_str(src: &str) -> Result<Self, UuidError> {
- use std::alloc::{alloc, Layout};
+ use std::alloc::{Layout, alloc};
let uuid: *mut [u8; 16] = unsafe { alloc(Layout::new::<[u8; 16]>()) as *mut [u8; 16] };
if src.len() == 36 {
// Unfortunately the manpage of `uuid_parse(3)` states that it technically requires a
diff --git a/proxmox-worker-task/src/lib.rs b/proxmox-worker-task/src/lib.rs
index 743ae53f..d6d7b330 100644
--- a/proxmox-worker-task/src/lib.rs
+++ b/proxmox-worker-task/src/lib.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Error};
+use anyhow::{Error, bail};
/// Worker task abstraction
///
--
2.39.5
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-03-04 15:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 14:40 [pbs-devel] [PATCH proxmox 1/9] mark extern C blocks as unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 2/9] daemon: set_var is now unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 3/9] mark blocks inside unsafe fns unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 4/9] broadcast_future: accommodate to edition 2024 changes to RPIT Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 5/9] procfs: add variable bindings for std::fs::read Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 6/9] port to edition 2024 Maximiliano Sandoval
2025-03-04 14:40 ` Maximiliano Sandoval [this message]
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 8/9] run cargo clippy --fix Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 9/9] manual clippy fixes Maximiliano Sandoval
2025-03-19 11:34 ` [pbs-devel] partially-applied: [PATCH proxmox 1/9] mark extern C blocks as unsafe Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250304144051.585163-7-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.