* [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90
@ 2025-12-29 16:18 Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/7] remove needless borrows Maximiliano Sandoval
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
This was spotted with clippy 0.1.90 and rustc 1.90.
After this, there is only one renaming clippy lint after running Clippy, namely:
```
$ cargo clippy --all-targets --workspace --all-features
warning: this function has too many arguments (8/7)
--> lib/pdm-client/src/lib.rs:1093:5
|
1093 | / pub async fn pve_list_storages(
1094 | | &self,
1095 | | remote: &str,
1096 | | node: &str,
... |
1101 | | target: Option<String>,
1102 | | ) -> Result<Vec<StorageInfo>, Error> {
| |________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: `#[warn(clippy::too_many_arguments)]` on by default
warning: `pdm-client` (lib) generated 1 warning
warning: `pdm-client` (lib test) generated 1 warning (1 duplicate)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
```
Maximiliano Sandoval (7):
remove needless borrows
simplify if-else block
remote tasks: remove unneeded enclosing Ok() and ?
firewall: prefer is_some_and over map_or false
subscription: remove unneeded return statement
api: resources: collapse identical if blocks
api: resources: rewrite let-else block with ?
cli/admin/src/remotes.rs | 2 +-
cli/client/src/subscriptions.rs | 2 +-
server/src/api/nodes/sdn.rs | 2 +-
server/src/api/nodes/subscription.rs | 2 +-
server/src/api/pve/firewall.rs | 2 +-
server/src/api/remote_shell.rs | 4 +--
server/src/api/resources.rs | 29 +++++++++----------
server/src/auth/mod.rs | 2 +-
.../tasks/remote_tasks.rs | 4 +--
9 files changed, 23 insertions(+), 26 deletions(-)
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 1/7] remove needless borrows
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/7] simplify if-else block Maximiliano Sandoval
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
Detected by clippy.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
cli/client/src/subscriptions.rs | 2 +-
server/src/api/nodes/sdn.rs | 2 +-
server/src/api/remote_shell.rs | 4 ++--
server/src/api/resources.rs | 2 +-
server/src/auth/mod.rs | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/cli/client/src/subscriptions.rs b/cli/client/src/subscriptions.rs
index bf450a5f..d8bf1e09 100644
--- a/cli/client/src/subscriptions.rs
+++ b/cli/client/src/subscriptions.rs
@@ -87,7 +87,7 @@ async fn get_subscription_status(
let mut node_status = node_status.iter().collect::<Vec<_>>();
- node_status.sort_by(|a, b| a.0.cmp(&b.0));
+ node_status.sort_by(|a, b| a.0.cmp(b.0));
for (node, info) in node_status {
let Some(info) = info else {
println!(" {node}");
diff --git a/server/src/api/nodes/sdn.rs b/server/src/api/nodes/sdn.rs
index 065ebe07..af5b7536 100644
--- a/server/src/api/nodes/sdn.rs
+++ b/server/src/api/nodes/sdn.rs
@@ -80,7 +80,7 @@ mod vnets {
) -> Result<Vec<SdnVnetMacVrf>, Error> {
let (remote_config, _) = pdm_config::remotes::config()?;
let remote = get_remote(&remote_config, &remote)?;
- let client = connect(&remote)?;
+ let client = connect(remote)?;
client
.get_vnet_mac_vrf(&node, &vnet)
diff --git a/server/src/api/remote_shell.rs b/server/src/api/remote_shell.rs
index c617b4dc..9a1dc183 100644
--- a/server/src/api/remote_shell.rs
+++ b/server/src/api/remote_shell.rs
@@ -171,7 +171,7 @@ fn upgrade_to_websocket(
let remote = get_remote(&remotes, &remote)?;
let (ticket, port) = match remote.ty {
RemoteType::Pve => {
- let pve = crate::connection::make_pve_client(&remote)?;
+ let pve = crate::connection::make_pve_client(remote)?;
let pve_term_ticket = pve
.node_shell_termproxy(
&node,
@@ -184,7 +184,7 @@ fn upgrade_to_websocket(
(pve_term_ticket.ticket, pve_term_ticket.port)
}
RemoteType::Pbs => {
- let pbs = crate::connection::make_pbs_client(&remote)?;
+ let pbs = crate::connection::make_pbs_client(remote)?;
let pbs_term_ticket = pbs.node_shell_termproxy().await?;
(pbs_term_ticket.ticket, pbs_term_ticket.port as i64)
}
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index c97644ad..ecccb94a 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -139,7 +139,7 @@ fn resource_matches_search_term(
MatchCategory::RemoteType => return None,
MatchCategory::NetworkType => match resource {
Resource::PveNetwork(network_resource) => {
- category.matches(&network_resource.network_type().as_str(), &term.value)
+ category.matches(network_resource.network_type().as_str(), &term.value)
}
_ => false,
},
diff --git a/server/src/auth/mod.rs b/server/src/auth/mod.rs
index 0d6bcddc..82425e8c 100644
--- a/server/src/auth/mod.rs
+++ b/server/src/auth/mod.rs
@@ -167,7 +167,7 @@ impl proxmox_auth_api::api::AuthContext for PdmAuthContext {
path_vec.push(part);
}
}
- user_info.check_privs(&auth_id, &path_vec, *privilege, false)?;
+ user_info.check_privs(auth_id, &path_vec, *privilege, false)?;
return Ok(Some(true));
}
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 2/7] simplify if-else block
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/7] remove needless borrows Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/7] remote tasks: remove unneeded enclosing Ok() and ? Maximiliano Sandoval
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
This was triggering the obfuscated_if_else clippy warning.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
cli/admin/src/remotes.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cli/admin/src/remotes.rs b/cli/admin/src/remotes.rs
index d1a3edee..edd3fd82 100644
--- a/cli/admin/src/remotes.rs
+++ b/cli/admin/src/remotes.rs
@@ -135,7 +135,7 @@ async fn get_remote_subscriptions(
RemoteSubscriptionState::Mixed => "Mixed",
RemoteSubscriptionState::Active => "Active",
};
- let ln = first.then_some("").unwrap_or("\n");
+ let ln = if first { "" } else { "\n" };
first = false;
println!("{ln}Remote {} subscription status: {state}", entry.remote);
if let Some(error) = entry.error {
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 3/7] remote tasks: remove unneeded enclosing Ok() and ?
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/7] remove needless borrows Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/7] simplify if-else block Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/7] firewall: prefer is_some_and over map_or false Maximiliano Sandoval
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
This was triggering the needless_question_mark clippy warning.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
server/src/bin/proxmox-datacenter-api/tasks/remote_tasks.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/src/bin/proxmox-datacenter-api/tasks/remote_tasks.rs b/server/src/bin/proxmox-datacenter-api/tasks/remote_tasks.rs
index c71a0894..435fd887 100644
--- a/server/src/bin/proxmox-datacenter-api/tasks/remote_tasks.rs
+++ b/server/src/bin/proxmox-datacenter-api/tasks/remote_tasks.rs
@@ -405,7 +405,7 @@ async fn apply_journal(cache: TaskCache) -> Result<(), Error> {
/// Get a list of active tasks.
async fn get_active_tasks(cache: TaskCache) -> Result<Vec<RemoteUpid>, Error> {
- Ok(tokio::task::spawn_blocking(move || {
+ tokio::task::spawn_blocking(move || {
let tasks: Vec<RemoteUpid> = cache
.read()?
.get_tasks(GetTasks::Active)?
@@ -414,7 +414,7 @@ async fn get_active_tasks(cache: TaskCache) -> Result<Vec<RemoteUpid>, Error> {
Ok::<Vec<RemoteUpid>, Error>(tasks)
})
- .await??)
+ .await?
}
#[derive(PartialEq, Debug)]
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 4/7] firewall: prefer is_some_and over map_or false
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
` (2 preceding siblings ...)
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/7] remote tasks: remove unneeded enclosing Ok() and ? Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 5/7] subscription: remove unneeded return statement Maximiliano Sandoval
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
server/src/api/pve/firewall.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/src/api/pve/firewall.rs b/server/src/api/pve/firewall.rs
index af11d582..d81592f7 100644
--- a/server/src/api/pve/firewall.rs
+++ b/server/src/api/pve/firewall.rs
@@ -132,7 +132,7 @@ async fn fetch_cluster_firewall_data(
let enabled = options_response
.await
- .map(|opts| opts.enable.map_or(false, |e| e != 0));
+ .map(|opts| opts.enable.is_some_and(|e| e != 0));
let rules = rules_response.await.map(|rules| {
let all = rules.len();
let active = rules.iter().filter(|r| r.enable == Some(1)).count();
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 5/7] subscription: remove unneeded return statement
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
` (3 preceding siblings ...)
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/7] firewall: prefer is_some_and over map_or false Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 6/7] api: resources: collapse identical if blocks Maximiliano Sandoval
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
server/src/api/nodes/subscription.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/src/api/nodes/subscription.rs b/server/src/api/nodes/subscription.rs
index 782e3a96..222bd883 100644
--- a/server/src/api/nodes/subscription.rs
+++ b/server/src/api/nodes/subscription.rs
@@ -84,7 +84,7 @@ fn check_counts(stats: &SubscriptionStatistics) -> Result<(), Error> {
(stats.active_subscriptions - stats.community) as f64 / stats.total_nodes as f64;
if basic_or_higher_ratio >= SUBSCRIPTION_THRESHOLD {
- return Ok(());
+ Ok(())
} else {
bail!("Too many remote nodes without active basic or higher subscription!");
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 6/7] api: resources: collapse identical if blocks
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
` (4 preceding siblings ...)
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 5/7] subscription: remove unneeded return statement Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 7/7] api: resources: rewrite let-else block with ? Maximiliano Sandoval
2025-12-30 9:18 ` [pdm-devel] partially-applied: [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Lukas Wagner
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
This was triggering the if_same_then_else clippy warning twice.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
server/src/api/resources.rs | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index ecccb94a..654a4550 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -409,18 +409,17 @@ pub(crate) async fn get_resources_impl(
for handle in join_handles {
let remote_with_resources = handle.await?;
- if filters.is_empty() {
- remote_resources.push(remote_with_resources);
- } else if !remote_with_resources.resources.is_empty() {
- remote_resources.push(remote_with_resources);
- } else if filters.matches(|filter| {
- remote_matches_search_term(
- &remote_with_resources.remote_name,
- &remote_with_resources.remote,
- Some(remote_with_resources.error.is_none()),
- filter,
- )
- }) {
+ if filters.is_empty()
+ || !remote_with_resources.resources.is_empty()
+ || filters.matches(|filter| {
+ remote_matches_search_term(
+ &remote_with_resources.remote_name,
+ &remote_with_resources.remote,
+ Some(remote_with_resources.error.is_none()),
+ filter,
+ )
+ })
+ {
remote_resources.push(remote_with_resources);
}
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] [PATCH proxmox-datacenter-manager 7/7] api: resources: rewrite let-else block with ?
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
` (5 preceding siblings ...)
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 6/7] api: resources: collapse identical if blocks Maximiliano Sandoval
@ 2025-12-29 16:18 ` Maximiliano Sandoval
2025-12-30 9:18 ` [pdm-devel] partially-applied: [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Lukas Wagner
7 siblings, 0 replies; 9+ messages in thread
From: Maximiliano Sandoval @ 2025-12-29 16:18 UTC (permalink / raw)
To: pdm-devel
This fixes the question_mark clippy lint.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
server/src/api/resources.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 654a4550..5d5fe2cc 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -1166,9 +1166,7 @@ pub(super) fn map_pve_network(
) -> Option<PveNetworkResource> {
match resource.ty {
ClusterResourceType::Network => {
- let Some(network_type) = resource.network_type else {
- return None;
- };
+ let network_type = resource.network_type?;
let id = format!("remote/{remote}/{}", &resource.id);
let node = resource.node.unwrap_or_default();
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pdm-devel] partially-applied: [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
` (6 preceding siblings ...)
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 7/7] api: resources: rewrite let-else block with ? Maximiliano Sandoval
@ 2025-12-30 9:18 ` Lukas Wagner
7 siblings, 0 replies; 9+ messages in thread
From: Lukas Wagner @ 2025-12-30 9:18 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Maximiliano Sandoval
On Mon Dec 29, 2025 at 5:18 PM CET, Maximiliano Sandoval wrote:
> This was spotted with clippy 0.1.90 and rustc 1.90.
>
[...]
Applied all of these patches except 3/7.
Patch 3/7 touches code that is moved around in a patch series of mine
[1]. I'll include your suggested fixup there if I have to post another
version, otherwise I'll fix the clippy warning once my patches have been
merged (or ask you to send a new patch).
[1] https://lore.proxmox.com/pdm-devel/20251229153004.377533-4-l.wagner@proxmox.com/T/#u
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-30 9:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29 16:18 [pdm-devel] [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/7] remove needless borrows Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/7] simplify if-else block Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/7] remote tasks: remove unneeded enclosing Ok() and ? Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/7] firewall: prefer is_some_and over map_or false Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 5/7] subscription: remove unneeded return statement Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 6/7] api: resources: collapse identical if blocks Maximiliano Sandoval
2025-12-29 16:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 7/7] api: resources: rewrite let-else block with ? Maximiliano Sandoval
2025-12-30 9:18 ` [pdm-devel] partially-applied: [PATCH proxmox-datacenter-manager 0/7] clippy fixes for 1.90 Lukas Wagner
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.