* [pbs-devel] [PATCH proxmox 01/10] adapt to rust 2024 match ergonomics
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 02/10] rustfmt: Set style_edition to 2021 Maximiliano Sandoval
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
See
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html
for more details.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxmox-acme-api/src/plugin_api_impl.rs | 4 +--
proxmox-acme-api/src/plugin_config.rs | 4 +--
proxmox-api-macro/src/api/method.rs | 8 +++---
proxmox-api-macro/src/api/structs.rs | 2 +-
proxmox-async/src/io/async_channel_writer.rs | 2 +-
proxmox-http/src/client/tls.rs | 30 ++++++++++----------
proxmox-http/src/rate_limited_stream.rs | 2 +-
proxmox-http/src/websocket/mod.rs | 2 +-
proxmox-network-api/src/config/lexer.rs | 4 +--
proxmox-notify/src/endpoints/smtp.rs | 2 +-
proxmox-router/src/cli/command.rs | 8 +++---
proxmox-router/src/permission.rs | 8 +++---
proxmox-router/src/stream/parsing.rs | 5 +---
proxmox-s3-client/src/object_key.rs | 4 +--
proxmox-schema/src/format.rs | 16 +++++------
proxmox-schema/src/schema.rs | 6 ++--
proxmox-upgrade-checks/src/lib.rs | 2 +-
17 files changed, 53 insertions(+), 56 deletions(-)
diff --git a/proxmox-acme-api/src/plugin_api_impl.rs b/proxmox-acme-api/src/plugin_api_impl.rs
index fe44aa2b..d0548e4b 100644
--- a/proxmox-acme-api/src/plugin_api_impl.rs
+++ b/proxmox-acme-api/src/plugin_api_impl.rs
@@ -83,7 +83,7 @@ pub fn update_plugin(
expected_digest.detect_modification(digest.as_ref())?;
match plugins.get_mut(&id) {
- Some((ty, ref mut entry)) => {
+ Some((ty, entry)) => {
if ty != "dns" {
bail!("cannot update plugin of type {:?}", ty);
}
@@ -150,7 +150,7 @@ fn modify_cfg_for_api(id: &str, ty: &str, data: &Value) -> PluginConfig {
// None of these should be able to fail unless the user changed the files by hand, in which
// case we leave the unmodified string in the Value for now. This will be handled with an error
// later.
- if let Some(Value::String(ref mut data)) = obj.get_mut("data") {
+ if let Some(Value::String(data)) = obj.get_mut("data") {
if let Ok(new) = proxmox_base64::url::decode_no_pad(&data) {
if let Ok(utf8) = String::from_utf8(new) {
*data = utf8;
diff --git a/proxmox-acme-api/src/plugin_config.rs b/proxmox-acme-api/src/plugin_config.rs
index c4685f2b..3295e15d 100644
--- a/proxmox-acme-api/src/plugin_config.rs
+++ b/proxmox-acme-api/src/plugin_config.rs
@@ -36,8 +36,8 @@ fn init() -> SectionConfig {
);
config.register_plugin(standalone_plugin);
- let dns_challenge_schema = match DnsPlugin::API_SCHEMA {
- Schema::AllOf(ref schema) => schema,
+ let dns_challenge_schema = match &DnsPlugin::API_SCHEMA {
+ Schema::AllOf(schema) => schema,
_ => unreachable!(),
};
let dns_challenge_plugin = SectionConfigPlugin::new(
diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index 68969735..0fe2cf42 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -30,7 +30,7 @@ pub enum ReturnType {
impl ReturnType {
fn as_mut_schema(&mut self) -> Option<&mut Schema> {
match self {
- ReturnType::Explicit(ReturnSchema { ref mut schema, .. }) => Some(schema),
+ ReturnType::Explicit(ReturnSchema { schema, .. }) => Some(schema),
_ => None,
}
}
@@ -589,7 +589,7 @@ fn create_wrapper_function(
let body = match method_info.flavor {
MethodFlavor::Normal => {
quote! {
- if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params {
+ if let ::serde_json::Value::Object(input_map) = &mut input_params {
#body
Ok(::serde_json::to_value(#func_name(#args) #await_keyword #question_mark)?)
} else {
@@ -599,7 +599,7 @@ fn create_wrapper_function(
}
MethodFlavor::Serializing => {
quote! {
- if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params {
+ if let ::serde_json::Value::Object(input_map) = &mut input_params {
#body
let res = #func_name(#args) #await_keyword #question_mark;
let res: ::std::boxed::Box<dyn ::proxmox_router::SerializableReturn + Send> = ::std::boxed::Box::new(res);
@@ -616,7 +616,7 @@ fn create_wrapper_function(
quote! { ::proxmox_router::SyncStream }
};
quote! {
- if let ::serde_json::Value::Object(ref mut input_map) = &mut input_params {
+ if let ::serde_json::Value::Object(input_map) = &mut input_params {
#body
let res = #func_name(#args) #await_keyword #question_mark;
let res = #ty::from(res);
diff --git a/proxmox-api-macro/src/api/structs.rs b/proxmox-api-macro/src/api/structs.rs
index ee537ff0..c18b20b4 100644
--- a/proxmox-api-macro/src/api/structs.rs
+++ b/proxmox-api-macro/src/api/structs.rs
@@ -164,7 +164,7 @@ fn handle_regular_struct(
let mut all_of_schemas = TokenStream::new();
let mut to_remove = Vec::new();
- if let syn::Fields::Named(ref fields) = &stru.fields {
+ if let syn::Fields::Named(fields) = &stru.fields {
for field in &fields.named {
let attrs = serde::FieldAttrib::try_from(&field.attrs[..])?;
diff --git a/proxmox-async/src/io/async_channel_writer.rs b/proxmox-async/src/io/async_channel_writer.rs
index 9dd64cd5..d9de8e27 100644
--- a/proxmox-async/src/io/async_channel_writer.rs
+++ b/proxmox-async/src/io/async_channel_writer.rs
@@ -76,7 +76,7 @@ impl AsyncChannelWriter {
self.state = WriterState::Sending(future.boxed());
}
- WriterState::Sending(ref mut future) => match ready!(future.as_mut().poll(cx)) {
+ WriterState::Sending(future) => match ready!(future.as_mut().poll(cx)) {
Ok(sender) => {
self.sender = Some(sender);
self.state = WriterState::Ready;
diff --git a/proxmox-http/src/client/tls.rs b/proxmox-http/src/client/tls.rs
index 9eba154a..f330d8f6 100644
--- a/proxmox-http/src/client/tls.rs
+++ b/proxmox-http/src/client/tls.rs
@@ -24,9 +24,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncRead for MaybeTlsStream<S> {
buf: &mut ReadBuf,
) -> Poll<Result<(), io::Error>> {
match self.get_mut() {
- MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_read(cx, buf),
- MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_read(cx, buf),
- MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_read(cx, buf),
+ MaybeTlsStream::Normal(s) => Pin::new(s).poll_read(cx, buf),
+ MaybeTlsStream::Proxied(s) => Pin::new(s).poll_read(cx, buf),
+ MaybeTlsStream::Secured(s) => Pin::new(s).poll_read(cx, buf),
}
}
}
@@ -38,9 +38,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> {
buf: &[u8],
) -> Poll<Result<usize, io::Error>> {
match self.get_mut() {
- MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_write(cx, buf),
- MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_write(cx, buf),
- MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_write(cx, buf),
+ MaybeTlsStream::Normal(s) => Pin::new(s).poll_write(cx, buf),
+ MaybeTlsStream::Proxied(s) => Pin::new(s).poll_write(cx, buf),
+ MaybeTlsStream::Secured(s) => Pin::new(s).poll_write(cx, buf),
}
}
@@ -50,9 +50,9 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> {
bufs: &[io::IoSlice<'_>],
) -> Poll<Result<usize, io::Error>> {
match self.get_mut() {
- MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs),
- MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs),
- MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_write_vectored(cx, bufs),
+ MaybeTlsStream::Normal(s) => Pin::new(s).poll_write_vectored(cx, bufs),
+ MaybeTlsStream::Proxied(s) => Pin::new(s).poll_write_vectored(cx, bufs),
+ MaybeTlsStream::Secured(s) => Pin::new(s).poll_write_vectored(cx, bufs),
}
}
@@ -66,17 +66,17 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncWrite for MaybeTlsStream<S> {
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), io::Error>> {
match self.get_mut() {
- MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_flush(cx),
- MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_flush(cx),
- MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_flush(cx),
+ MaybeTlsStream::Normal(s) => Pin::new(s).poll_flush(cx),
+ MaybeTlsStream::Proxied(s) => Pin::new(s).poll_flush(cx),
+ MaybeTlsStream::Secured(s) => Pin::new(s).poll_flush(cx),
}
}
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), io::Error>> {
match self.get_mut() {
- MaybeTlsStream::Normal(ref mut s) => Pin::new(s).poll_shutdown(cx),
- MaybeTlsStream::Proxied(ref mut s) => Pin::new(s).poll_shutdown(cx),
- MaybeTlsStream::Secured(ref mut s) => Pin::new(s).poll_shutdown(cx),
+ MaybeTlsStream::Normal(s) => Pin::new(s).poll_shutdown(cx),
+ MaybeTlsStream::Proxied(s) => Pin::new(s).poll_shutdown(cx),
+ MaybeTlsStream::Secured(s) => Pin::new(s).poll_shutdown(cx),
}
}
}
diff --git a/proxmox-http/src/rate_limited_stream.rs b/proxmox-http/src/rate_limited_stream.rs
index 18ce864f..5fc5949a 100644
--- a/proxmox-http/src/rate_limited_stream.rs
+++ b/proxmox-http/src/rate_limited_stream.rs
@@ -177,7 +177,7 @@ fn register_traffic(limiter: &dyn ShareableRateLimit, count: usize) -> Option<Pi
fn delay_is_ready(delay: &mut Option<Pin<Box<Sleep>>>, ctx: &mut Context<'_>) -> bool {
match delay {
- Some(ref mut future) => future.as_mut().poll(ctx).is_ready(),
+ Some(future) => future.as_mut().poll(ctx).is_ready(),
None => true,
}
}
diff --git a/proxmox-http/src/websocket/mod.rs b/proxmox-http/src/websocket/mod.rs
index 5ce53651..88d25f44 100644
--- a/proxmox-http/src/websocket/mod.rs
+++ b/proxmox-http/src/websocket/mod.rs
@@ -550,7 +550,7 @@ impl<R: AsyncRead + Unpin + Send + 'static> AsyncRead for WebSocketReader<R> {
this.state = ReaderState::Receiving(future.boxed());
}
- ReaderState::Receiving(ref mut future) => match ready!(future.as_mut().poll(cx)) {
+ ReaderState::Receiving(future) => match ready!(future.as_mut().poll(cx)) {
Ok(ReadResult {
len,
reader,
diff --git a/proxmox-network-api/src/config/lexer.rs b/proxmox-network-api/src/config/lexer.rs
index bc0392cf..4729d462 100644
--- a/proxmox-network-api/src/config/lexer.rs
+++ b/proxmox-network-api/src/config/lexer.rs
@@ -121,8 +121,8 @@ impl<R: BufRead> Iterator for Lexer<R> {
self.cur_line = Some(Self::split_line(&line));
}
- match self.cur_line {
- Some(ref mut cur_line) => {
+ match &mut self.cur_line {
+ Some(cur_line) => {
if cur_line.is_empty() {
self.cur_line = None;
Some(Ok((Token::Newline, String::from("\n"))))
diff --git a/proxmox-notify/src/endpoints/smtp.rs b/proxmox-notify/src/endpoints/smtp.rs
index c888dee7..6785932f 100644
--- a/proxmox-notify/src/endpoints/smtp.rs
+++ b/proxmox-notify/src/endpoints/smtp.rs
@@ -254,7 +254,7 @@ impl Endpoint for SmtpEndpoint {
.map_err(|err| Error::NotifyFailed(self.name().into(), Box::new(err)))?
}
#[cfg(feature = "mail-forwarder")]
- Content::ForwardedMail { ref raw, .. } => {
+ Content::ForwardedMail { raw, .. } => {
build_forwarded_message(email_builder, self.name(), raw)?
}
};
diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs
index 42de796d..3389dc50 100644
--- a/proxmox-router/src/cli/command.rs
+++ b/proxmox-router/src/cli/command.rs
@@ -337,10 +337,10 @@ pub async fn handle_command_future(
set_help_context(Some(def.clone()));
let result = match &*def {
- CommandLineInterface::Simple(ref cli_cmd) => {
+ CommandLineInterface::Simple(cli_cmd) => {
handle_simple_command_future(prefix, cli_cmd, args, rpcenv).await
}
- CommandLineInterface::Nested(ref map) => {
+ CommandLineInterface::Nested(map) => {
let mut prefix = prefix.to_string();
let cli_cmd = parse_nested_command(&mut prefix, map, &mut args)?;
handle_simple_command_future(&prefix, cli_cmd, args, rpcenv).await
@@ -366,10 +366,10 @@ pub fn handle_command(
set_help_context(Some(def.clone()));
let result = match &*def {
- CommandLineInterface::Simple(ref cli_cmd) => {
+ CommandLineInterface::Simple(cli_cmd) => {
handle_simple_command(prefix, cli_cmd, args, &mut rpcenv, run, [].into_iter())
}
- CommandLineInterface::Nested(ref map) => {
+ CommandLineInterface::Nested(map) => {
let mut prefix = prefix.to_string();
let cli_cmd = parse_nested_command(&mut prefix, map, &mut args)?;
handle_simple_command(&prefix, cli_cmd, args, &mut rpcenv, run, [].into_iter())
diff --git a/proxmox-router/src/permission.rs b/proxmox-router/src/permission.rs
index 3b20343c..e3be3387 100644
--- a/proxmox-router/src/permission.rs
+++ b/proxmox-router/src/permission.rs
@@ -38,9 +38,9 @@ impl fmt::Debug for Permission {
Permission::Superuser => f.write_str("Superuser"),
Permission::World => f.write_str("World"),
Permission::Anybody => f.write_str("Anybody"),
- Permission::User(ref userid) => write!(f, "User({userid})"),
+ Permission::User(userid) => write!(f, "User({userid})"),
Permission::UserParam(param_name) => write!(f, "UserParam({param_name})"),
- Permission::Group(ref group) => write!(f, "Group({group})"),
+ Permission::Group(group) => write!(f, "Group({group})"),
Permission::WithParam(param_name, subtest) => {
write!(f, "WithParam({param_name}, {subtest:?})")
}
@@ -122,12 +122,12 @@ fn check_api_permission_tail(
},
Permission::User(expected_userid) => match userid {
None => return false,
- Some(ref userid) => return userid == expected_userid,
+ Some(userid) => return &userid == expected_userid,
},
Permission::UserParam(param_name) => match (userid, param.get(¶m_name.to_string())) {
(None, _) => return false,
(_, None) => return false,
- (Some(ref userid), Some(ref expected)) => return userid == expected,
+ (Some(userid), Some(expected)) => return userid == expected,
},
Permission::Group(expected_group) => match userid {
None => return false,
diff --git a/proxmox-router/src/stream/parsing.rs b/proxmox-router/src/stream/parsing.rs
index ced59918..975d7c11 100644
--- a/proxmox-router/src/stream/parsing.rs
+++ b/proxmox-router/src/stream/parsing.rs
@@ -272,10 +272,7 @@ impl AsyncBufRead for BodyBufReader {
cx: &mut std::task::Context<'_>,
) -> Poll<io::Result<&[u8]>> {
use hyper::body::Body as HyperBody;
- let Self {
- ref mut reader,
- ref mut buf_at,
- } = Pin::into_inner(self);
+ let Self { reader, buf_at } = Pin::into_inner(self);
loop {
// If we currently have a buffer, use it:
if let Some((buf, at)) = buf_at {
diff --git a/proxmox-s3-client/src/object_key.rs b/proxmox-s3-client/src/object_key.rs
index 4c8d95b4..34189409 100644
--- a/proxmox-s3-client/src/object_key.rs
+++ b/proxmox-s3-client/src/object_key.rs
@@ -35,8 +35,8 @@ impl S3ObjectKey {
/// If the object key is already a full key, the prefix is ignored.
pub(crate) fn to_full_key(&self, prefix: &str) -> Self {
match self {
- Self::Full(ref key) => Self::Full(key.to_string()),
- Self::Relative(ref key) => {
+ Self::Full(key) => Self::Full(key.to_string()),
+ Self::Relative(key) => {
let prefix = prefix.strip_prefix("/").unwrap_or(prefix);
Self::Full(format!("{prefix}/{key}"))
}
diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs
index 080b0268..c1e33a68 100644
--- a/proxmox-schema/src/format.rs
+++ b/proxmox-schema/src/format.rs
@@ -229,30 +229,30 @@ pub fn get_property_description(
let (descr, default, extra) = match schema {
Schema::Null => ("null", None, None),
- Schema::String(ref schema) => (
+ Schema::String(schema) => (
schema.description,
schema.default.map(|v| v.to_owned()),
None,
),
- Schema::Boolean(ref schema) => (
+ Schema::Boolean(schema) => (
schema.description,
schema.default.map(|v| v.to_string()),
None,
),
- Schema::Integer(ref schema) => (
+ Schema::Integer(schema) => (
schema.description,
schema.default.map(|v| v.to_string()),
None,
),
- Schema::Number(ref schema) => (
+ Schema::Number(schema) => (
schema.description,
schema.default.map(|v| v.to_string()),
None,
),
- Schema::Object(ref schema) => (schema.description, None, None),
- Schema::AllOf(ref schema) => (schema.description, None, None),
- Schema::OneOf(ref schema) => (schema.description, None, None),
- Schema::Array(ref schema) => (
+ Schema::Object(schema) => (schema.description, None, None),
+ Schema::AllOf(schema) => (schema.description, None, None),
+ Schema::OneOf(schema) => (schema.description, None, None),
+ Schema::Array(schema) => (
schema.description,
None,
Some(String::from("Can be specified more than once.")),
diff --git a/proxmox-schema/src/schema.rs b/proxmox-schema/src/schema.rs
index 40ede2f1..8413d40b 100644
--- a/proxmox-schema/src/schema.rs
+++ b/proxmox-schema/src/schema.rs
@@ -608,7 +608,7 @@ impl ArraySchema {
/// Verify JSON value using an `ArraySchema`.
pub fn verify_json(&self, data: &Value) -> Result<(), Error> {
let list = match data {
- Value::Array(ref list) => list,
+ Value::Array(list) => list,
Value::Object(_) => bail!("Expected array - got object."),
_ => bail!("Expected array - got scalar value."),
};
@@ -1091,7 +1091,7 @@ pub trait ObjectSchemaType: private::Sealed + Send + Sync {
/// Verify JSON value using an object schema.
fn verify_json(&self, data: &Value) -> Result<(), Error> {
let map = match data {
- Value::Object(ref map) => map,
+ Value::Object(map) => map,
Value::Array(_) => bail!("Expected object - got array."),
_ => bail!("Expected object - got scalar value."),
};
@@ -1285,7 +1285,7 @@ impl ObjectSchemaType for OneOfSchema {
fn verify_json(&self, data: &Value) -> Result<(), Error> {
let map = match data {
- Value::Object(ref map) => map,
+ Value::Object(map) => map,
Value::Array(_) => bail!("Expected object - got array."),
_ => bail!("Expected object - got scalar value."),
};
diff --git a/proxmox-upgrade-checks/src/lib.rs b/proxmox-upgrade-checks/src/lib.rs
index f9b66876..cfd85ff2 100644
--- a/proxmox-upgrade-checks/src/lib.rs
+++ b/proxmox-upgrade-checks/src/lib.rs
@@ -508,7 +508,7 @@ impl UpgradeChecker {
continue;
}
- if let Some((ref current_suite, ref current_location)) = found_suite {
+ if let Some((current_suite, current_location)) = found_suite {
let location = repo_file.path.clone().unwrap_or_default();
if suite != current_suite {
if mismatches.is_empty() {
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 02/10] rustfmt: Set style_edition to 2021
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 01/10] adapt to rust 2024 match ergonomics Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 03/10] cargo: set workspace edition to 2024 Maximiliano Sandoval
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
As a stopgap to keep the diffs manageable. It will be removed in a
couple of commits.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
rustfmt.toml | 1 +
1 file changed, 1 insertion(+)
diff --git a/rustfmt.toml b/rustfmt.toml
index 3a26366d..a85c0976 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1 +1,2 @@
edition = "2021"
+style_edition = "2021"
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 03/10] cargo: set workspace edition to 2024
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 01/10] adapt to rust 2024 match ergonomics Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 02/10] rustfmt: Set style_edition to 2021 Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 04/10] cargo: run fmt Maximiliano Sandoval
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Cargo.toml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 27a69afa..554c6cb7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,12 +69,12 @@ resolver = "2"
[workspace.package]
authors = ["Proxmox Support Team <support@proxmox.com>"]
-edition = "2021"
+edition = "2024"
license = "AGPL-3"
repository = "https://git.proxmox.com/?p=proxmox.git"
homepage = "https://proxmox.com"
exclude = [ "debian" ]
-rust-version = "1.82"
+rust-version = "1.85"
[workspace.dependencies]
# any features enabled here are enabled on all members using 'workspace = true'!
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 04/10] cargo: run fmt
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (2 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 03/10] cargo: set workspace edition to 2024 Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 05/10] cargo: set resolver to 3 Maximiliano Sandoval
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
To reflect changes in rust 2024, see
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rustfmt-formatting-fixes.html.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pbs-api-types/src/jobs.rs | 8 ++++++--
proxmox-api-macro/src/api/method.rs | 2 +-
proxmox-auth-api/src/auth_key.rs | 6 +++---
proxmox-http/src/body.rs | 4 ----
proxmox-network-api/src/api_impl.rs | 4 +++-
proxmox-oci/src/lib.rs | 2 +-
proxmox-rest-server/src/connection.rs | 6 ++++--
proxmox-schema/src/de/mod.rs | 2 +-
proxmox-schema/src/schema.rs | 4 +++-
proxmox-subscription/src/files.rs | 2 +-
proxmox-tfa/src/api/mod.rs | 4 ++--
proxmox-tfa/src/totp.rs | 6 ++++--
proxmox-upgrade-checks/src/lib.rs | 2 +-
13 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
index 7e6dfb94..b188cdc6 100644
--- a/pbs-api-types/src/jobs.rs
+++ b/pbs-api-types/src/jobs.rs
@@ -463,11 +463,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/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index 0fe2cf42..ab0801aa 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -530,7 +530,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-auth-api/src/auth_key.rs b/proxmox-auth-api/src/auth_key.rs
index 2ccc1110..667deaaf 100644
--- a/proxmox-auth-api/src/auth_key.rs
+++ b/proxmox-auth-api/src/auth_key.rs
@@ -320,7 +320,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),
_ => (),
@@ -330,10 +330,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-http/src/body.rs b/proxmox-http/src/body.rs
index 18075099..4547ac57 100644
--- a/proxmox-http/src/body.rs
+++ b/proxmox-http/src/body.rs
@@ -46,9 +46,7 @@ impl Body {
pub fn wrap_stream<S>(stream: S) -> Body
where
S: futures::stream::TryStream + Send + 'static,
-
S::Error: Into<Error>,
-
Bytes: From<S::Ok>,
{
Body::stream(stream)
@@ -57,9 +55,7 @@ impl Body {
pub(crate) fn stream<S>(stream: S) -> Body
where
S: futures::stream::TryStream + Send + 'static,
-
S::Error: Into<Error>,
-
Bytes: From<S::Ok>,
{
use futures::TryStreamExt;
diff --git a/proxmox-network-api/src/api_impl.rs b/proxmox-network-api/src/api_impl.rs
index 18602900..50dc46af 100644
--- a/proxmox-network-api/src/api_impl.rs
+++ b/proxmox-network-api/src/api_impl.rs
@@ -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-oci/src/lib.rs b/proxmox-oci/src/lib.rs
index cce68207..3b92d849 100644
--- a/proxmox-oci/src/lib.rs
+++ b/proxmox-oci/src/lib.rs
@@ -217,7 +217,7 @@ fn extract_image_rootfs<R: Read + Seek, P: AsRef<Path>>(
| MediaType::ArtifactManifest
| MediaType::EmptyJSON
| MediaType::Other(_)) => {
- return Err(ExtractError::WrongMediaType(media_type.to_string()))
+ return Err(ExtractError::WrongMediaType(media_type.to_string()));
}
};
diff --git a/proxmox-rest-server/src/connection.rs b/proxmox-rest-server/src/connection.rs
index 3ac1967c..1faa3828 100644
--- a/proxmox-rest-server/src/connection.rs
+++ b/proxmox-rest-server/src/connection.rs
@@ -362,7 +362,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");
}
};
@@ -468,7 +468,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-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index ca6b4981..ea5661d8 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -638,7 +638,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/schema.rs b/proxmox-schema/src/schema.rs
index 8413d40b..ddd11761 100644
--- a/proxmox-schema/src/schema.rs
+++ b/proxmox-schema/src/schema.rs
@@ -1454,7 +1454,9 @@ impl Schema {
if let Some(key) = default_key {
param_list.push((key.to_string(), value.into_owned()));
} else {
- bail!("Value '{value}' without key, but schema does not define a default key.");
+ bail!(
+ "Value '{value}' without key, but schema does not define a default key."
+ );
}
}
}
diff --git a/proxmox-subscription/src/files.rs b/proxmox-subscription/src/files.rs
index 1644e90a..a450e131 100644
--- a/proxmox-subscription/src/files.rs
+++ b/proxmox-subscription/src/files.rs
@@ -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-tfa/src/api/mod.rs b/proxmox-tfa/src/api/mod.rs
index 321658e9..5d1386fa 100644
--- a/proxmox-tfa/src/api/mod.rs
+++ b/proxmox-tfa/src/api/mod.rs
@@ -1228,11 +1228,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/totp.rs b/proxmox-tfa/src/totp.rs
index 4035dca3..aac584d0 100644
--- a/proxmox-tfa/src/totp.rs
+++ b/proxmox-tfa/src/totp.rs
@@ -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-upgrade-checks/src/lib.rs b/proxmox-upgrade-checks/src/lib.rs
index cfd85ff2..93080bb7 100644
--- a/proxmox-upgrade-checks/src/lib.rs
+++ b/proxmox-upgrade-checks/src/lib.rs
@@ -603,7 +603,7 @@ impl UpgradeChecker {
\n While not necessary for the upgrade it's recommended to use one of:\
\n * chrony (Default in new Proxmox product installations)\
\n * ntpsec\
- \n * openntpd"
+ \n * openntpd",
)?;
} else if self.get_systemd_unit_state("ntp.service")?.1 == SystemdUnitState::Active {
self.output.log_info(
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 05/10] cargo: set resolver to 3
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (3 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 04/10] cargo: run fmt Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 06/10] cargo: run --fix Maximiliano Sandoval
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
This is the default since edition 2024 which the crate uses. See
https://doc.rust-lang.org/edition-guide/rust-2024/cargo-resolver.html
for more details.
Do note that removing the key would result in:
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2024 which implies `resolver = "3"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2024 resolver, specify `workspace.resolver = "3"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
hence we explicitly opt-in the default.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cargo.toml b/Cargo.toml
index 554c6cb7..a3575ec6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,7 +65,7 @@ members = [
exclude = [
"build",
]
-resolver = "2"
+resolver = "3"
[workspace.package]
authors = ["Proxmox Support Team <support@proxmox.com>"]
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 06/10] cargo: run --fix
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (4 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 05/10] cargo: set resolver to 3 Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 07/10] cargo: run fmt again Maximiliano Sandoval
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
It mostly fixes the lippy::collapsible_if lint.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pbs-api-types/src/maintenance.rs | 5 ++--
proxmox-api-macro/src/api/enums.rs | 5 ++--
proxmox-api-macro/src/api/method.rs | 21 ++++++--------
proxmox-api-macro/src/serde.rs | 5 ++--
proxmox-api-macro/src/util.rs | 28 ++++++++-----------
proxmox-apt/src/cache.rs | 5 ++--
proxmox-apt/src/cache_api.rs | 5 ++--
proxmox-apt/src/deb822/release_file.rs | 5 ++--
proxmox-apt/src/repositories/file.rs | 5 ++--
.../src/repositories/file/list_parser.rs | 5 ++--
proxmox-apt/src/repositories/repository.rs | 5 ++--
proxmox-config-digest/src/lib.rs | 5 ++--
proxmox-ldap/src/sync.rs | 5 ++--
proxmox-rrd/src/cache/journal.rs | 11 +++-----
proxmox-section-config/src/lib.rs | 5 ++--
proxmox-section-config/src/typed.rs | 5 ++--
proxmox-tfa/src/api/mod.rs | 14 ++++------
proxmox-tfa/src/api/webauthn.rs | 5 ++--
pve-api-types/src/types/array.rs | 5 ++--
pve-api-types/src/types/verifiers.rs | 9 +++---
20 files changed, 62 insertions(+), 96 deletions(-)
diff --git a/pbs-api-types/src/maintenance.rs b/pbs-api-types/src/maintenance.rs
index 6b97ff10..404d2c32 100644
--- a/pbs-api-types/src/maintenance.rs
+++ b/pbs-api-types/src/maintenance.rs
@@ -110,11 +110,10 @@ impl MaintenanceMode {
bail!("offline maintenance mode: {}", message);
} else if self.ty == MaintenanceType::S3Refresh {
bail!("S3 refresh maintenance mode: {}", message);
- } else if self.ty == MaintenanceType::ReadOnly {
- if let Some(Operation::Write) = operation {
+ } else if self.ty == MaintenanceType::ReadOnly
+ && let Some(Operation::Write) = operation {
bail!("read-only maintenance mode: {}", message);
}
- }
Ok(())
}
}
diff --git a/proxmox-api-macro/src/api/enums.rs b/proxmox-api-macro/src/api/enums.rs
index ae5c05e1..378e7f05 100644
--- a/proxmox-api-macro/src/api/enums.rs
+++ b/proxmox-api-macro/src/api/enums.rs
@@ -137,8 +137,8 @@ fn handle_string_enum(
syn::LitStr::new(&name.to_string(), name.span())
};
- if derives_default {
- if let Some(attr) = variant.attrs.iter().find(|a| a.path().is_ident("default")) {
+ if derives_default
+ && let Some(attr) = variant.attrs.iter().find(|a| a.path().is_ident("default")) {
if let Some(default_value) = &default_value {
error!(attr => "multiple default values defined");
error!(default_value => "default previously defined here");
@@ -150,7 +150,6 @@ fn handle_string_enum(
}
}
}
- }
variants.extend(quote_spanned! { variant.ident.span() =>
::proxmox_schema::EnumEntry {
diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index ab0801aa..c55a21d4 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -493,8 +493,8 @@ fn handle_function_signature(method_info: &mut MethodInfo) -> Result<Ident, Erro
}
fn is_api_method_type(ty: &syn::Type) -> bool {
- if let syn::Type::Reference(r) = ty {
- if let syn::Type::Path(p) = &*r.elem {
+ if let syn::Type::Reference(r) = ty
+ && let syn::Type::Path(p) = &*r.elem {
if p.qself.is_some() {
return false;
}
@@ -502,20 +502,16 @@ fn is_api_method_type(ty: &syn::Type) -> bool {
return ps.ident == "ApiMethod";
}
}
- }
false
}
fn is_rpc_env_type(ty: &syn::Type) -> bool {
- if let syn::Type::Reference(r) = ty {
- if let syn::Type::TraitObject(t) = &*r.elem {
- if let Some(syn::TypeParamBound::Trait(b)) = t.bounds.first() {
- if let Some(ps) = b.path.segments.last() {
+ if let syn::Type::Reference(r) = ty
+ && let syn::Type::TraitObject(t) = &*r.elem
+ && let Some(syn::TypeParamBound::Trait(b)) = t.bounds.first()
+ && let Some(ps) = b.path.segments.last() {
return ps.ident == "RpcEnvironment";
}
- }
- }
- }
false
}
@@ -945,8 +941,8 @@ struct DefaultParameters<'a>(&'a Schema);
impl VisitMut for DefaultParameters<'_> {
fn visit_expr_mut(&mut self, i: &mut syn::Expr) {
- if let syn::Expr::Macro(exprmac) = i {
- if exprmac.mac.path.is_ident("api_get_default") {
+ if let syn::Expr::Macro(exprmac) = i
+ && exprmac.mac.path.is_ident("api_get_default") {
// replace api_get_default macros with the actual default found in the #[api]
// macro.
match self.get_default(mem::take(&mut exprmac.mac.tokens)) {
@@ -957,7 +953,6 @@ impl VisitMut for DefaultParameters<'_> {
}
}
}
- }
visit_mut::visit_expr_mut(self, i)
}
diff --git a/proxmox-api-macro/src/serde.rs b/proxmox-api-macro/src/serde.rs
index 0412b945..52dd8fed 100644
--- a/proxmox-api-macro/src/serde.rs
+++ b/proxmox-api-macro/src/serde.rs
@@ -229,11 +229,10 @@ impl FieldAttrib {
}
pub fn check_non_option_type(&self) {
- if let Some(span) = self.has_skip_serializing_if {
- if !self.has_default {
+ if let Some(span) = self.has_skip_serializing_if
+ && !self.has_default {
error!(span, "`skip_serializing_if` without `default`");
}
- }
}
}
diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs
index 9ed3fa0b..042684ff 100644
--- a/proxmox-api-macro/src/util.rs
+++ b/proxmox-api-macro/src/util.rs
@@ -434,19 +434,17 @@ pub fn derive_descriptions(
let mut parts = doc_comment.split("\nReturns:");
- if let Some(first) = parts.next() {
- if input_schema.description.is_none() {
+ if let Some(first) = parts.next()
+ && input_schema.description.is_none() {
input_schema.description = Maybe::Derived(syn::LitStr::new(first.trim(), doc_span));
}
- }
if let Some(second) = parts.next() {
- if let Some(returns_schema) = returns_schema {
- if returns_schema.description.is_none() {
+ if let Some(returns_schema) = returns_schema
+ && returns_schema.description.is_none() {
returns_schema.description =
Maybe::Derived(syn::LitStr::new(second.trim(), doc_span));
}
- }
if parts.next().is_some() {
bail!(
@@ -519,13 +517,11 @@ pub fn is_option_type(ty: &syn::Type) -> Option<&syn::Type> {
return None;
}
- if let syn::PathArguments::AngleBracketed(generic) = &segs.last().unwrap().arguments {
- if generic.args.len() == 1 {
- if let syn::GenericArgument::Type(ty) = generic.args.first().unwrap() {
+ if let syn::PathArguments::AngleBracketed(generic) = &segs.last().unwrap().arguments
+ && generic.args.len() == 1
+ && let syn::GenericArgument::Type(ty) = generic.args.first().unwrap() {
return Some(ty);
}
- }
- }
}
None
}
@@ -747,20 +743,18 @@ where
for arg in std::mem::take(&mut args).into_pairs() {
match arg {
Pair::Punctuated(item, punct) => {
- if let syn::Meta::Path(path) = &item {
- if !func(path) {
+ if let syn::Meta::Path(path) = &item
+ && !func(path) {
continue;
}
- }
args.push_value(item);
args.push_punct(punct);
}
Pair::End(item) => {
- if let syn::Meta::Path(path) = &item {
- if !func(path) {
+ if let syn::Meta::Path(path) = &item
+ && !func(path) {
continue;
}
- }
args.push_value(item);
}
}
diff --git a/proxmox-apt/src/cache.rs b/proxmox-apt/src/cache.rs
index bd8d6c89..bd12eb22 100644
--- a/proxmox-apt/src/cache.rs
+++ b/proxmox-apt/src/cache.rs
@@ -247,11 +247,10 @@ where
// versions anyway
let mut pkg_iter = origin.file();
let pkg_file = pkg_iter.next();
- if let Some(pkg_file) = pkg_file {
- if let Some(origin_name) = pkg_file.origin() {
+ if let Some(pkg_file) = pkg_file
+ && let Some(origin_name) = pkg_file.origin() {
origin_res = origin_name;
}
- }
}
if let Some(depends) = depends {
diff --git a/proxmox-apt/src/cache_api.rs b/proxmox-apt/src/cache_api.rs
index 0c55fbc9..d2c7dbfc 100644
--- a/proxmox-apt/src/cache_api.rs
+++ b/proxmox-apt/src/cache_api.rs
@@ -13,11 +13,10 @@ pub fn list_available_apt_update<P: AsRef<Path>>(
apt_state_file: P,
) -> Result<Vec<APTUpdateInfo>, Error> {
let apt_state_file = apt_state_file.as_ref();
- if let Ok(false) = crate::cache::pkg_cache_expired(apt_state_file) {
- if let Ok(Some(cache)) = crate::cache::read_pkg_state(apt_state_file) {
+ if let Ok(false) = crate::cache::pkg_cache_expired(apt_state_file)
+ && let Ok(Some(cache)) = crate::cache::read_pkg_state(apt_state_file) {
return Ok(cache.package_status);
}
- }
let cache = crate::cache::update_cache(apt_state_file)?;
diff --git a/proxmox-apt/src/deb822/release_file.rs b/proxmox-apt/src/deb822/release_file.rs
index d7b6009c..e5e9ed74 100644
--- a/proxmox-apt/src/deb822/release_file.rs
+++ b/proxmox-apt/src/deb822/release_file.rs
@@ -150,12 +150,11 @@ impl FileReferenceType {
}
"debian-installer" => {
// another layer, then like regular repo but pointing at udebs
- if let Some((dir, rest)) = rest.split_once('/') {
- if let Some(arch) = dir.strip_prefix("binary-") {
+ if let Some((dir, rest)) = rest.split_once('/')
+ && let Some(arch) = dir.strip_prefix("binary-") {
// Packages or compat-Release
return parse_binary_dir(rest, arch);
}
- }
// all the rest
Ok(FileReferenceType::Unknown)
diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
index 1c8afce7..abf9e55e 100644
--- a/proxmox-apt/src/repositories/file.rs
+++ b/proxmox-apt/src/repositories/file.rs
@@ -350,14 +350,13 @@ impl APTRepositoryFileImpl for APTRepositoryFile {
add_info("warning", message_new(base_suite));
}
- if let Some(require_suffix) = require_suffix {
- if suffix != require_suffix {
+ if let Some(require_suffix) = require_suffix
+ && suffix != require_suffix {
add_info(
"warning",
format!("expected suite '{current_codename}{require_suffix}'"),
);
}
- }
}
}
diff --git a/proxmox-apt/src/repositories/file/list_parser.rs b/proxmox-apt/src/repositories/file/list_parser.rs
index 6eb57157..b800473c 100644
--- a/proxmox-apt/src/repositories/file/list_parser.rs
+++ b/proxmox-apt/src/repositories/file/list_parser.rs
@@ -165,12 +165,11 @@ impl<R: BufRead> APTListFileParser<R> {
line = line.trim_matches(|c| char::is_ascii_whitespace(&c));
// check for commented out repository first
- if let Some(commented_out) = line.strip_prefix('#') {
- if let Ok(Some(mut repo)) = self.parse_one_line(commented_out) {
+ if let Some(commented_out) = line.strip_prefix('#')
+ && let Ok(Some(mut repo)) = self.parse_one_line(commented_out) {
repo.set_enabled(false);
return Ok(Some(repo));
}
- }
let mut repo = APTRepository::new(APTRepositoryFileType::List);
diff --git a/proxmox-apt/src/repositories/repository.rs b/proxmox-apt/src/repositories/repository.rs
index 24e7943b..4ec1c4e7 100644
--- a/proxmox-apt/src/repositories/repository.rs
+++ b/proxmox-apt/src/repositories/repository.rs
@@ -224,11 +224,10 @@ fn uri_to_filename(uri: &str) -> String {
filename = &filename[(begin + 3)..];
}
- if uri.starts_with("http://") || uri.starts_with("https://") {
- if let Some(begin) = filename.find('@') {
+ if (uri.starts_with("http://") || uri.starts_with("https://"))
+ && let Some(begin) = filename.find('@') {
filename = &filename[(begin + 1)..];
}
- }
// APT seems to only strip one final slash, so do the same
filename = filename.strip_suffix('/').unwrap_or(filename);
diff --git a/proxmox-config-digest/src/lib.rs b/proxmox-config-digest/src/lib.rs
index a34a3a90..993e31cc 100644
--- a/proxmox-config-digest/src/lib.rs
+++ b/proxmox-config-digest/src/lib.rs
@@ -41,11 +41,10 @@ impl ConfigDigest {
///
/// This function fails with a reasonable error message if checksums do not match.
pub fn detect_modification(&self, user_digest: Option<&Self>) -> Result<(), Error> {
- if let Some(user_digest) = user_digest {
- if user_digest != self {
+ if let Some(user_digest) = user_digest
+ && user_digest != self {
bail!("detected modified configuration - file changed by other user? Try again.");
}
- }
Ok(())
}
}
diff --git a/proxmox-ldap/src/sync.rs b/proxmox-ldap/src/sync.rs
index f0d43e14..87841ec3 100644
--- a/proxmox-ldap/src/sync.rs
+++ b/proxmox-ldap/src/sync.rs
@@ -339,13 +339,12 @@ impl LdapRealmSyncJob {
user_config.sections.remove(&tokenid_string);
- if !self.dry_run {
- if let Err(e) =
+ if !self.dry_run
+ && let Err(e) =
proxmox_access_control::token_shadow::delete_secret(&tokenid)
{
log::warn!("could not delete token for user {userid}: {e}",)
}
- }
if self.general_sync_settings.should_remove_acls() {
acl_config.delete_authid(&tokenid);
diff --git a/proxmox-rrd/src/cache/journal.rs b/proxmox-rrd/src/cache/journal.rs
index 0753d015..a78d06ee 100644
--- a/proxmox-rrd/src/cache/journal.rs
+++ b/proxmox-rrd/src/cache/journal.rs
@@ -170,19 +170,16 @@ impl JournalState {
Some(_) => (),
}
- if let Some(extension) = path.extension() {
- if let Some(extension) = extension.to_str() {
- if let Some(rest) = extension.strip_prefix("journal-") {
- if let Ok(time) = u64::from_str_radix(rest, 16) {
+ if let Some(extension) = path.extension()
+ && let Some(extension) = extension.to_str()
+ && let Some(rest) = extension.strip_prefix("journal-")
+ && let Ok(time) = u64::from_str_radix(rest, 16) {
list.push(JournalFileInfo {
time,
name: format!("rrd.{extension}"),
path: path.to_owned(),
});
}
- }
- }
- }
}
list.sort_unstable_by_key(|entry| entry.time);
Ok(list)
diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs
index 2222fbf1..3fca933d 100644
--- a/proxmox-section-config/src/lib.rs
+++ b/proxmox-section-config/src/lib.rs
@@ -433,12 +433,11 @@ impl SectionConfig {
id_property: &Option<String>|
-> Result<(), Error> {
for (name, optional, _prop_schema) in schema.properties() {
- if let Some(id_property) = id_property {
- if name == id_property {
+ if let Some(id_property) = id_property
+ && name == id_property {
// the id_property is the section header, skip for requirement check
continue;
}
- }
if !*optional && value[name] == Value::Null {
return Err(format_err!(
"property '{}' is missing and it is not optional.",
diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index 5250fd86..b06d290e 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -215,11 +215,10 @@ impl<T> SectionConfigData<T> {
{
let removed_value = self.sections.remove(key);
// only update the order vector if we actually removed something
- if removed_value.is_some() {
- if let Some(pos) = self.order.iter().position(|k| k.borrow() == key) {
+ if removed_value.is_some()
+ && let Some(pos) = self.order.iter().position(|k| k.borrow() == key) {
self.order.remove(pos);
}
- }
removed_value
}
}
diff --git a/proxmox-tfa/src/api/mod.rs b/proxmox-tfa/src/api/mod.rs
index 5d1386fa..5b2841be 100644
--- a/proxmox-tfa/src/api/mod.rs
+++ b/proxmox-tfa/src/api/mod.rs
@@ -434,11 +434,10 @@ impl TfaConfig {
save = true;
}
- if save {
- if let Err(err) = data.save() {
+ if save
+ && let Err(err) = data.save() {
log::error!("failed to store user challenge data: {err}");
}
- }
r
}
Ok(r) => r,
@@ -993,8 +992,7 @@ impl TfaUserData {
if let Some(entry) = self
.enabled_u2f_entries()
.find(|e| e.key.key_handle == response.key_handle())
- {
- if u2f
+ && u2f
.auth_verify_obj(&entry.public_key, &challenge.challenge, response)?
.is_some()
{
@@ -1017,7 +1015,6 @@ impl TfaUserData {
return Ok(());
}
- }
bail!("u2f verification failed");
}
@@ -1089,8 +1086,8 @@ impl TfaUserData {
userid: &str,
value: &str,
) -> Result<(), Error> {
- if let Some(r) = &mut self.recovery {
- if r.verify(value)? {
+ if let Some(r) = &mut self.recovery
+ && r.verify(value)? {
// On success we reset the failure state.
self.totp_locked = false;
self.tfa_locked_until = None;
@@ -1103,7 +1100,6 @@ impl TfaUserData {
}
return Ok(());
}
- }
bail!("recovery verification failed");
}
diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs
index 56cf9073..8343d721 100644
--- a/proxmox-tfa/src/api/webauthn.rs
+++ b/proxmox-tfa/src/api/webauthn.rs
@@ -196,11 +196,10 @@ fn force_allow_backup_eligibility(
) -> Result<SecurityKeyAuthentication, Error> {
let mut state =
serde_json::to_value(&state).context("failed to convert authentication state to json")?;
- if let Some(obj) = state.get_mut("ast") {
- if let Some(allow) = obj.get_mut("allow_backup_eligible_upgrade") {
+ if let Some(obj) = state.get_mut("ast")
+ && let Some(allow) = obj.get_mut("allow_backup_eligible_upgrade") {
*allow = serde_json::Value::Bool(true);
}
- }
serde_json::from_value(state).context("failed to convert json back to authentication state")
}
diff --git a/pve-api-types/src/types/array.rs b/pve-api-types/src/types/array.rs
index 6f468fbf..75a98af4 100644
--- a/pve-api-types/src/types/array.rs
+++ b/pve-api-types/src/types/array.rs
@@ -174,8 +174,8 @@ impl<T, const MAX: usize> ArrayMap<T, { MAX }> {
let mut this = ArrayMap::default();
while let Some((key, value)) = map.next_entry::<std::borrow::Cow<str>, T>()? {
- if let Some(id) = key.as_ref().strip_prefix(self.prefix) {
- if let Ok(id) = id.parse::<usize>() {
+ if let Some(id) = key.as_ref().strip_prefix(self.prefix)
+ && let Ok(id) = id.parse::<usize>() {
if this.insert(id, value).map_err(A::Error::custom)?.is_some() {
return Err(A::Error::custom(format!(
"multiple '{}{id}' elements",
@@ -184,7 +184,6 @@ impl<T, const MAX: usize> ArrayMap<T, { MAX }> {
}
continue;
}
- }
return Err(A::Error::custom(format!(
"invalid array element name {key}"
)));
diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index c45063b5..18d16470 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -152,9 +152,9 @@ pub fn verify_cidrv6(s: &str) -> Result<(), Error> {
pub fn verify_ip_or_cidr(s: &str) -> Result<(), Error> {
if verify_cidr(s).is_ok() {
- return Ok(());
+ Ok(())
} else if verify_ip(s).is_ok() {
- return Ok(());
+ Ok(())
} else {
bail!("not a valid IP address or CIDR notation");
}
@@ -217,11 +217,10 @@ pub fn verify_lxc_mp_string(s: &str) -> Result<(), Error> {
}
pub fn verify_ip_with_ll_iface(s: &str) -> Result<(), Error> {
- if let Some(percent) = s.find('%') {
- if FE80_RE.is_match(s) && IFACE_RE.is_match(&s[(percent + 1)..]) {
+ if let Some(percent) = s.find('%')
+ && FE80_RE.is_match(s) && IFACE_RE.is_match(&s[(percent + 1)..]) {
return verify_ipv6(&s[..percent]);
}
- }
verify_ip(s)
}
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 07/10] cargo: run fmt again
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (5 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 06/10] cargo: run --fix Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 08/10] Remove rustfmt.toml and run cargo fmt Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 10/10] pve-api-types: specify rustfmt --edition 2024 Maximiliano Sandoval
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pbs-api-types/src/maintenance.rs | 7 +-
proxmox-api-macro/src/api/enums.rs | 21 +++---
proxmox-api-macro/src/api/method.rs | 43 ++++++------
proxmox-api-macro/src/serde.rs | 7 +-
proxmox-api-macro/src/util.rs | 36 +++++-----
proxmox-apt/src/cache.rs | 7 +-
proxmox-apt/src/cache_api.rs | 7 +-
proxmox-apt/src/deb822/release_file.rs | 9 +--
proxmox-apt/src/repositories/file.rs | 13 ++--
.../src/repositories/file/list_parser.rs | 9 +--
proxmox-apt/src/repositories/repository.rs | 7 +-
proxmox-config-digest/src/lib.rs | 7 +-
proxmox-ldap/src/sync.rs | 6 +-
proxmox-rrd/src/cache/journal.rs | 17 ++---
proxmox-section-config/src/lib.rs | 9 +--
proxmox-section-config/src/typed.rs | 7 +-
proxmox-tfa/src/api/mod.rs | 68 +++++++++----------
proxmox-tfa/src/api/webauthn.rs | 7 +-
pve-api-types/src/types/array.rs | 17 ++---
pve-api-types/src/types/verifiers.rs | 8 ++-
20 files changed, 168 insertions(+), 144 deletions(-)
diff --git a/pbs-api-types/src/maintenance.rs b/pbs-api-types/src/maintenance.rs
index 404d2c32..baf4e29a 100644
--- a/pbs-api-types/src/maintenance.rs
+++ b/pbs-api-types/src/maintenance.rs
@@ -111,9 +111,10 @@ impl MaintenanceMode {
} else if self.ty == MaintenanceType::S3Refresh {
bail!("S3 refresh maintenance mode: {}", message);
} else if self.ty == MaintenanceType::ReadOnly
- && let Some(Operation::Write) = operation {
- bail!("read-only maintenance mode: {}", message);
- }
+ && let Some(Operation::Write) = operation
+ {
+ bail!("read-only maintenance mode: {}", message);
+ }
Ok(())
}
}
diff --git a/proxmox-api-macro/src/api/enums.rs b/proxmox-api-macro/src/api/enums.rs
index 378e7f05..483686f2 100644
--- a/proxmox-api-macro/src/api/enums.rs
+++ b/proxmox-api-macro/src/api/enums.rs
@@ -138,18 +138,19 @@ fn handle_string_enum(
};
if derives_default
- && let Some(attr) = variant.attrs.iter().find(|a| a.path().is_ident("default")) {
- if let Some(default_value) = &default_value {
- error!(attr => "multiple default values defined");
- error!(default_value => "default previously defined here");
- } else {
- default_value = Some(variant_string.clone());
- if let Some(span) = has_default_attrib {
- error!(attr => "#[default] attribute in use with 'default' #[api] key");
- error!(span, "'default' also defined here");
- }
+ && let Some(attr) = variant.attrs.iter().find(|a| a.path().is_ident("default"))
+ {
+ if let Some(default_value) = &default_value {
+ error!(attr => "multiple default values defined");
+ error!(default_value => "default previously defined here");
+ } else {
+ default_value = Some(variant_string.clone());
+ if let Some(span) = has_default_attrib {
+ error!(attr => "#[default] attribute in use with 'default' #[api] key");
+ error!(span, "'default' also defined here");
}
}
+ }
variants.extend(quote_spanned! { variant.ident.span() =>
::proxmox_schema::EnumEntry {
diff --git a/proxmox-api-macro/src/api/method.rs b/proxmox-api-macro/src/api/method.rs
index c55a21d4..fdea5f35 100644
--- a/proxmox-api-macro/src/api/method.rs
+++ b/proxmox-api-macro/src/api/method.rs
@@ -494,24 +494,26 @@ fn handle_function_signature(method_info: &mut MethodInfo) -> Result<Ident, Erro
fn is_api_method_type(ty: &syn::Type) -> bool {
if let syn::Type::Reference(r) = ty
- && let syn::Type::Path(p) = &*r.elem {
- if p.qself.is_some() {
- return false;
- }
- if let Some(ps) = p.path.segments.last() {
- return ps.ident == "ApiMethod";
- }
+ && let syn::Type::Path(p) = &*r.elem
+ {
+ if p.qself.is_some() {
+ return false;
}
+ if let Some(ps) = p.path.segments.last() {
+ return ps.ident == "ApiMethod";
+ }
+ }
false
}
fn is_rpc_env_type(ty: &syn::Type) -> bool {
if let syn::Type::Reference(r) = ty
&& let syn::Type::TraitObject(t) = &*r.elem
- && let Some(syn::TypeParamBound::Trait(b)) = t.bounds.first()
- && let Some(ps) = b.path.segments.last() {
- return ps.ident == "RpcEnvironment";
- }
+ && let Some(syn::TypeParamBound::Trait(b)) = t.bounds.first()
+ && let Some(ps) = b.path.segments.last()
+ {
+ return ps.ident == "RpcEnvironment";
+ }
false
}
@@ -942,17 +944,18 @@ struct DefaultParameters<'a>(&'a Schema);
impl VisitMut for DefaultParameters<'_> {
fn visit_expr_mut(&mut self, i: &mut syn::Expr) {
if let syn::Expr::Macro(exprmac) = i
- && exprmac.mac.path.is_ident("api_get_default") {
- // replace api_get_default macros with the actual default found in the #[api]
- // macro.
- match self.get_default(mem::take(&mut exprmac.mac.tokens)) {
- Ok(expr) => *i = expr,
- Err(err) => {
- *i = syn::Expr::Verbatim(err.to_compile_error());
- return;
- }
+ && exprmac.mac.path.is_ident("api_get_default")
+ {
+ // replace api_get_default macros with the actual default found in the #[api]
+ // macro.
+ match self.get_default(mem::take(&mut exprmac.mac.tokens)) {
+ Ok(expr) => *i = expr,
+ Err(err) => {
+ *i = syn::Expr::Verbatim(err.to_compile_error());
+ return;
}
}
+ }
visit_mut::visit_expr_mut(self, i)
}
diff --git a/proxmox-api-macro/src/serde.rs b/proxmox-api-macro/src/serde.rs
index 52dd8fed..345b3f2e 100644
--- a/proxmox-api-macro/src/serde.rs
+++ b/proxmox-api-macro/src/serde.rs
@@ -230,9 +230,10 @@ impl FieldAttrib {
pub fn check_non_option_type(&self) {
if let Some(span) = self.has_skip_serializing_if
- && !self.has_default {
- error!(span, "`skip_serializing_if` without `default`");
- }
+ && !self.has_default
+ {
+ error!(span, "`skip_serializing_if` without `default`");
+ }
}
}
diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs
index 042684ff..db2acdf2 100644
--- a/proxmox-api-macro/src/util.rs
+++ b/proxmox-api-macro/src/util.rs
@@ -435,16 +435,17 @@ pub fn derive_descriptions(
let mut parts = doc_comment.split("\nReturns:");
if let Some(first) = parts.next()
- && input_schema.description.is_none() {
- input_schema.description = Maybe::Derived(syn::LitStr::new(first.trim(), doc_span));
- }
+ && input_schema.description.is_none()
+ {
+ input_schema.description = Maybe::Derived(syn::LitStr::new(first.trim(), doc_span));
+ }
if let Some(second) = parts.next() {
if let Some(returns_schema) = returns_schema
- && returns_schema.description.is_none() {
- returns_schema.description =
- Maybe::Derived(syn::LitStr::new(second.trim(), doc_span));
- }
+ && returns_schema.description.is_none()
+ {
+ returns_schema.description = Maybe::Derived(syn::LitStr::new(second.trim(), doc_span));
+ }
if parts.next().is_some() {
bail!(
@@ -519,9 +520,10 @@ pub fn is_option_type(ty: &syn::Type) -> Option<&syn::Type> {
if let syn::PathArguments::AngleBracketed(generic) = &segs.last().unwrap().arguments
&& generic.args.len() == 1
- && let syn::GenericArgument::Type(ty) = generic.args.first().unwrap() {
- return Some(ty);
- }
+ && let syn::GenericArgument::Type(ty) = generic.args.first().unwrap()
+ {
+ return Some(ty);
+ }
}
None
}
@@ -744,17 +746,19 @@ where
match arg {
Pair::Punctuated(item, punct) => {
if let syn::Meta::Path(path) = &item
- && !func(path) {
- continue;
- }
+ && !func(path)
+ {
+ continue;
+ }
args.push_value(item);
args.push_punct(punct);
}
Pair::End(item) => {
if let syn::Meta::Path(path) = &item
- && !func(path) {
- continue;
- }
+ && !func(path)
+ {
+ continue;
+ }
args.push_value(item);
}
}
diff --git a/proxmox-apt/src/cache.rs b/proxmox-apt/src/cache.rs
index bd12eb22..b27fa886 100644
--- a/proxmox-apt/src/cache.rs
+++ b/proxmox-apt/src/cache.rs
@@ -248,9 +248,10 @@ where
let mut pkg_iter = origin.file();
let pkg_file = pkg_iter.next();
if let Some(pkg_file) = pkg_file
- && let Some(origin_name) = pkg_file.origin() {
- origin_res = origin_name;
- }
+ && let Some(origin_name) = pkg_file.origin()
+ {
+ origin_res = origin_name;
+ }
}
if let Some(depends) = depends {
diff --git a/proxmox-apt/src/cache_api.rs b/proxmox-apt/src/cache_api.rs
index d2c7dbfc..771c69ee 100644
--- a/proxmox-apt/src/cache_api.rs
+++ b/proxmox-apt/src/cache_api.rs
@@ -14,9 +14,10 @@ pub fn list_available_apt_update<P: AsRef<Path>>(
) -> Result<Vec<APTUpdateInfo>, Error> {
let apt_state_file = apt_state_file.as_ref();
if let Ok(false) = crate::cache::pkg_cache_expired(apt_state_file)
- && let Ok(Some(cache)) = crate::cache::read_pkg_state(apt_state_file) {
- return Ok(cache.package_status);
- }
+ && let Ok(Some(cache)) = crate::cache::read_pkg_state(apt_state_file)
+ {
+ return Ok(cache.package_status);
+ }
let cache = crate::cache::update_cache(apt_state_file)?;
diff --git a/proxmox-apt/src/deb822/release_file.rs b/proxmox-apt/src/deb822/release_file.rs
index e5e9ed74..54e4afa8 100644
--- a/proxmox-apt/src/deb822/release_file.rs
+++ b/proxmox-apt/src/deb822/release_file.rs
@@ -151,10 +151,11 @@ impl FileReferenceType {
"debian-installer" => {
// another layer, then like regular repo but pointing at udebs
if let Some((dir, rest)) = rest.split_once('/')
- && let Some(arch) = dir.strip_prefix("binary-") {
- // Packages or compat-Release
- return parse_binary_dir(rest, arch);
- }
+ && let Some(arch) = dir.strip_prefix("binary-")
+ {
+ // Packages or compat-Release
+ return parse_binary_dir(rest, arch);
+ }
// all the rest
Ok(FileReferenceType::Unknown)
diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
index abf9e55e..b0e426c2 100644
--- a/proxmox-apt/src/repositories/file.rs
+++ b/proxmox-apt/src/repositories/file.rs
@@ -351,12 +351,13 @@ impl APTRepositoryFileImpl for APTRepositoryFile {
}
if let Some(require_suffix) = require_suffix
- && suffix != require_suffix {
- add_info(
- "warning",
- format!("expected suite '{current_codename}{require_suffix}'"),
- );
- }
+ && suffix != require_suffix
+ {
+ add_info(
+ "warning",
+ format!("expected suite '{current_codename}{require_suffix}'"),
+ );
+ }
}
}
diff --git a/proxmox-apt/src/repositories/file/list_parser.rs b/proxmox-apt/src/repositories/file/list_parser.rs
index b800473c..7a0e23a5 100644
--- a/proxmox-apt/src/repositories/file/list_parser.rs
+++ b/proxmox-apt/src/repositories/file/list_parser.rs
@@ -166,10 +166,11 @@ impl<R: BufRead> APTListFileParser<R> {
// check for commented out repository first
if let Some(commented_out) = line.strip_prefix('#')
- && let Ok(Some(mut repo)) = self.parse_one_line(commented_out) {
- repo.set_enabled(false);
- return Ok(Some(repo));
- }
+ && let Ok(Some(mut repo)) = self.parse_one_line(commented_out)
+ {
+ repo.set_enabled(false);
+ return Ok(Some(repo));
+ }
let mut repo = APTRepository::new(APTRepositoryFileType::List);
diff --git a/proxmox-apt/src/repositories/repository.rs b/proxmox-apt/src/repositories/repository.rs
index 4ec1c4e7..57fe16da 100644
--- a/proxmox-apt/src/repositories/repository.rs
+++ b/proxmox-apt/src/repositories/repository.rs
@@ -225,9 +225,10 @@ fn uri_to_filename(uri: &str) -> String {
}
if (uri.starts_with("http://") || uri.starts_with("https://"))
- && let Some(begin) = filename.find('@') {
- filename = &filename[(begin + 1)..];
- }
+ && let Some(begin) = filename.find('@')
+ {
+ filename = &filename[(begin + 1)..];
+ }
// APT seems to only strip one final slash, so do the same
filename = filename.strip_suffix('/').unwrap_or(filename);
diff --git a/proxmox-config-digest/src/lib.rs b/proxmox-config-digest/src/lib.rs
index 993e31cc..0b113f21 100644
--- a/proxmox-config-digest/src/lib.rs
+++ b/proxmox-config-digest/src/lib.rs
@@ -42,9 +42,10 @@ impl ConfigDigest {
/// This function fails with a reasonable error message if checksums do not match.
pub fn detect_modification(&self, user_digest: Option<&Self>) -> Result<(), Error> {
if let Some(user_digest) = user_digest
- && user_digest != self {
- bail!("detected modified configuration - file changed by other user? Try again.");
- }
+ && user_digest != self
+ {
+ bail!("detected modified configuration - file changed by other user? Try again.");
+ }
Ok(())
}
}
diff --git a/proxmox-ldap/src/sync.rs b/proxmox-ldap/src/sync.rs
index 87841ec3..e5bfdf3e 100644
--- a/proxmox-ldap/src/sync.rs
+++ b/proxmox-ldap/src/sync.rs
@@ -342,9 +342,9 @@ impl LdapRealmSyncJob {
if !self.dry_run
&& let Err(e) =
proxmox_access_control::token_shadow::delete_secret(&tokenid)
- {
- log::warn!("could not delete token for user {userid}: {e}",)
- }
+ {
+ log::warn!("could not delete token for user {userid}: {e}",)
+ }
if self.general_sync_settings.should_remove_acls() {
acl_config.delete_authid(&tokenid);
diff --git a/proxmox-rrd/src/cache/journal.rs b/proxmox-rrd/src/cache/journal.rs
index a78d06ee..80711021 100644
--- a/proxmox-rrd/src/cache/journal.rs
+++ b/proxmox-rrd/src/cache/journal.rs
@@ -172,14 +172,15 @@ impl JournalState {
if let Some(extension) = path.extension()
&& let Some(extension) = extension.to_str()
- && let Some(rest) = extension.strip_prefix("journal-")
- && let Ok(time) = u64::from_str_radix(rest, 16) {
- list.push(JournalFileInfo {
- time,
- name: format!("rrd.{extension}"),
- path: path.to_owned(),
- });
- }
+ && let Some(rest) = extension.strip_prefix("journal-")
+ && let Ok(time) = u64::from_str_radix(rest, 16)
+ {
+ list.push(JournalFileInfo {
+ time,
+ name: format!("rrd.{extension}"),
+ path: path.to_owned(),
+ });
+ }
}
list.sort_unstable_by_key(|entry| entry.time);
Ok(list)
diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs
index 3fca933d..fec6a423 100644
--- a/proxmox-section-config/src/lib.rs
+++ b/proxmox-section-config/src/lib.rs
@@ -434,10 +434,11 @@ impl SectionConfig {
-> Result<(), Error> {
for (name, optional, _prop_schema) in schema.properties() {
if let Some(id_property) = id_property
- && name == id_property {
- // the id_property is the section header, skip for requirement check
- continue;
- }
+ && name == id_property
+ {
+ // the id_property is the section header, skip for requirement check
+ continue;
+ }
if !*optional && value[name] == Value::Null {
return Err(format_err!(
"property '{}' is missing and it is not optional.",
diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index b06d290e..55cb3c75 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -216,9 +216,10 @@ impl<T> SectionConfigData<T> {
let removed_value = self.sections.remove(key);
// only update the order vector if we actually removed something
if removed_value.is_some()
- && let Some(pos) = self.order.iter().position(|k| k.borrow() == key) {
- self.order.remove(pos);
- }
+ && let Some(pos) = self.order.iter().position(|k| k.borrow() == key)
+ {
+ self.order.remove(pos);
+ }
removed_value
}
}
diff --git a/proxmox-tfa/src/api/mod.rs b/proxmox-tfa/src/api/mod.rs
index 5b2841be..f8188346 100644
--- a/proxmox-tfa/src/api/mod.rs
+++ b/proxmox-tfa/src/api/mod.rs
@@ -434,10 +434,9 @@ impl TfaConfig {
save = true;
}
- if save
- && let Err(err) = data.save() {
- log::error!("failed to store user challenge data: {err}");
- }
+ if save && let Err(err) = data.save() {
+ log::error!("failed to store user challenge data: {err}");
+ }
r
}
Ok(r) => r,
@@ -995,26 +994,26 @@ impl TfaUserData {
&& u2f
.auth_verify_obj(&entry.public_key, &challenge.challenge, response)?
.is_some()
- {
- let mut data = match access.open_no_create(userid)? {
- Some(data) => data,
- None => bail!("no such challenge"),
- };
- let index = data
- .get_mut()
- .u2f_auths
- .iter()
- .position(|r| r == challenge)
- .ok_or_else(|| format_err!("no such challenge"))?;
- let entry = data.get_mut().u2f_auths.remove(index);
- if entry.is_expired(expire_before) {
- bail!("no such challenge");
- }
- data.save()
- .map_err(|err| format_err!("failed to save challenge file: {}", err))?;
-
- return Ok(());
+ {
+ let mut data = match access.open_no_create(userid)? {
+ Some(data) => data,
+ None => bail!("no such challenge"),
+ };
+ let index = data
+ .get_mut()
+ .u2f_auths
+ .iter()
+ .position(|r| r == challenge)
+ .ok_or_else(|| format_err!("no such challenge"))?;
+ let entry = data.get_mut().u2f_auths.remove(index);
+ if entry.is_expired(expire_before) {
+ bail!("no such challenge");
}
+ data.save()
+ .map_err(|err| format_err!("failed to save challenge file: {}", err))?;
+
+ return Ok(());
+ }
bail!("u2f verification failed");
}
@@ -1087,19 +1086,20 @@ impl TfaUserData {
value: &str,
) -> Result<(), Error> {
if let Some(r) = &mut self.recovery
- && r.verify(value)? {
- // On success we reset the failure state.
- self.totp_locked = false;
- self.tfa_locked_until = None;
+ && r.verify(value)?
+ {
+ // On success we reset the failure state.
+ self.totp_locked = false;
+ self.tfa_locked_until = None;
- let mut data = access.open(userid)?;
- let access = data.get_mut();
- if access.totp_failures != 0 {
- access.totp_failures = 0;
- data.save()?;
- }
- return Ok(());
+ let mut data = access.open(userid)?;
+ let access = data.get_mut();
+ if access.totp_failures != 0 {
+ access.totp_failures = 0;
+ data.save()?;
}
+ return Ok(());
+ }
bail!("recovery verification failed");
}
diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs
index 8343d721..8c08401c 100644
--- a/proxmox-tfa/src/api/webauthn.rs
+++ b/proxmox-tfa/src/api/webauthn.rs
@@ -197,9 +197,10 @@ fn force_allow_backup_eligibility(
let mut state =
serde_json::to_value(&state).context("failed to convert authentication state to json")?;
if let Some(obj) = state.get_mut("ast")
- && let Some(allow) = obj.get_mut("allow_backup_eligible_upgrade") {
- *allow = serde_json::Value::Bool(true);
- }
+ && let Some(allow) = obj.get_mut("allow_backup_eligible_upgrade")
+ {
+ *allow = serde_json::Value::Bool(true);
+ }
serde_json::from_value(state).context("failed to convert json back to authentication state")
}
diff --git a/pve-api-types/src/types/array.rs b/pve-api-types/src/types/array.rs
index 75a98af4..1465c5f2 100644
--- a/pve-api-types/src/types/array.rs
+++ b/pve-api-types/src/types/array.rs
@@ -175,15 +175,16 @@ impl<T, const MAX: usize> ArrayMap<T, { MAX }> {
while let Some((key, value)) = map.next_entry::<std::borrow::Cow<str>, T>()? {
if let Some(id) = key.as_ref().strip_prefix(self.prefix)
- && let Ok(id) = id.parse::<usize>() {
- if this.insert(id, value).map_err(A::Error::custom)?.is_some() {
- return Err(A::Error::custom(format!(
- "multiple '{}{id}' elements",
- self.prefix
- )));
- }
- continue;
+ && let Ok(id) = id.parse::<usize>()
+ {
+ if this.insert(id, value).map_err(A::Error::custom)?.is_some() {
+ return Err(A::Error::custom(format!(
+ "multiple '{}{id}' elements",
+ self.prefix
+ )));
}
+ continue;
+ }
return Err(A::Error::custom(format!(
"invalid array element name {key}"
)));
diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index 18d16470..25098b6f 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -218,9 +218,11 @@ pub fn verify_lxc_mp_string(s: &str) -> Result<(), Error> {
pub fn verify_ip_with_ll_iface(s: &str) -> Result<(), Error> {
if let Some(percent) = s.find('%')
- && FE80_RE.is_match(s) && IFACE_RE.is_match(&s[(percent + 1)..]) {
- return verify_ipv6(&s[..percent]);
- }
+ && FE80_RE.is_match(s)
+ && IFACE_RE.is_match(&s[(percent + 1)..])
+ {
+ return verify_ipv6(&s[..percent]);
+ }
verify_ip(s)
}
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 08/10] Remove rustfmt.toml and run cargo fmt
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (6 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 07/10] cargo: run fmt again Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 10/10] pve-api-types: specify rustfmt --edition 2024 Maximiliano Sandoval
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
rustfmt.toml | 2 --
1 file changed, 2 deletions(-)
delete mode 100644 rustfmt.toml
diff --git a/rustfmt.toml b/rustfmt.toml
deleted file mode 100644
index a85c0976..00000000
--- a/rustfmt.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-edition = "2021"
-style_edition = "2021"
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* [pbs-devel] [PATCH proxmox 10/10] pve-api-types: specify rustfmt --edition 2024
2026-01-26 15:13 [pbs-devel] [PATCH proxmox 00/10] Bump edition to 2024 Maximiliano Sandoval
` (7 preceding siblings ...)
2026-01-26 15:13 ` [pbs-devel] [PATCH proxmox 08/10] Remove rustfmt.toml and run cargo fmt Maximiliano Sandoval
@ 2026-01-26 15:13 ` Maximiliano Sandoval
8 siblings, 0 replies; 10+ messages in thread
From: Maximiliano Sandoval @ 2026-01-26 15:13 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pve-api-types/generate.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index e5c5d051..3f222e31 100755
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -581,14 +581,14 @@ my $type_pid = open2(
'>&'.fileno($type_fh),
my $type_pipe,
#'cat',
- 'rustfmt', '--edition=2021', '--config', 'wrap_comments=true'
+ 'rustfmt', '--edition=2024', '--config', 'wrap_comments=true'
);
open(my $code_fh, '>', $code_out_file) or die "failed to open '$code_out_file': $!\n";
my $code_pid = open2(
'>&'.fileno($code_fh),
my $code_pipe,
#'cat',
- 'rustfmt', '--edition=2021', '--config', 'wrap_comments=true'
+ 'rustfmt', '--edition=2024', '--config', 'wrap_comments=true'
);
close($type_fh);
close($code_fh);
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 10+ messages in thread