* [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation
@ 2025-01-13 12:12 Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-13 12:12 UTC (permalink / raw)
To: pdm-devel
Fixes the manual_range_contains clippy lint:
warning: manual `!RangeInclusive::contains` implementation
--> lib/proxmox-api-types/pve-api-types/src/types/verifiers.rs:200:12
|
200 | if vid > 4094 || vid < 2 {
| ^^^^^^^^^^^^^^^^^^^^^ help: use: `!(2..=4094).contains(&vid)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `#[warn(clippy::manual_range_contains)]` on by default
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pve-api-types/src/types/verifiers.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index e17e190..004db9e 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -199,10 +199,10 @@ pub fn verify_pve_lxc_dev_string(s: &str) -> Result<(), Error> {
pub fn verify_vlan_id_or_range(s: &str) -> Result<(), Error> {
let check_vid = |vid: u16| -> Result<(), Error> {
- if vid > 4094 || vid < 2 {
- bail!("invalid VLAN tag '{vid}'");
- } else {
+ if (2..=4094).contains(&vid) {
Ok(())
+ } else {
+ bail!("invalid VLAN tag '{vid}'");
}
};
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
@ 2025-01-13 12:12 ` Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format! Maximiliano Sandoval
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-13 12:12 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pve-api-types/src/types/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pve-api-types/src/types/mod.rs b/pve-api-types/src/types/mod.rs
index bbcc32c..e8f5c86 100644
--- a/pve-api-types/src/types/mod.rs
+++ b/pve-api-types/src/types/mod.rs
@@ -117,7 +117,7 @@ impl<'de> serde::Deserialize<'de> for PveUpid {
{
struct ForwardToStrVisitor;
- impl<'a> serde::de::Visitor<'a> for ForwardToStrVisitor {
+ impl serde::de::Visitor<'_> for ForwardToStrVisitor {
type Value = PveUpid;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format!
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
@ 2025-01-13 12:12 ` Maximiliano Sandoval
2025-01-14 13:21 ` Wolfgang Bumiller
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 4/4] generated code: Do not return unit value Maximiliano Sandoval
2025-01-13 12:21 ` [pdm-devel] applied: [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Dietmar Maurer
3 siblings, 1 reply; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-13 12:12 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pve-api-types/src/generated/code.rs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index dc17cd9..3da259b 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -764,8 +764,8 @@ where
/// Authentication domain index.
async fn list_domains(&self) -> Result<Vec<ListRealm>, Error> {
- let url = format!("/api2/extjs/access/domains");
- Ok(self.0.get(&url).await?.expect_json()?.data)
+ let url = "/api2/extjs/access/domains";
+ Ok(self.0.get(url).await?.expect_json()?.data)
}
/// LXC container index (per node).
@@ -788,8 +788,8 @@ where
/// Cluster node index.
async fn list_nodes(&self) -> Result<Vec<ClusterNodeIndexResponse>, Error> {
- let url = format!("/api2/extjs/nodes");
- Ok(self.0.get(&url).await?.expect_json()?.data)
+ let url = "/api2/extjs/nodes";
+ Ok(self.0.get(url).await?.expect_json()?.data)
}
/// Virtual machine index (per node).
@@ -1010,7 +1010,7 @@ where
/// API version details, including some parts of the global datacenter
/// config.
async fn version(&self) -> Result<VersionResponse, Error> {
- let url = format!("/api2/extjs/version");
- Ok(self.0.get(&url).await?.expect_json()?.data)
+ let url = "/api2/extjs/version";
+ Ok(self.0.get(url).await?.expect_json()?.data)
}
}
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH proxmox-api-types 4/4] generated code: Do not return unit value
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format! Maximiliano Sandoval
@ 2025-01-13 12:12 ` Maximiliano Sandoval
2025-01-13 12:21 ` [pdm-devel] applied: [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Dietmar Maurer
3 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-13 12:12 UTC (permalink / raw)
To: pdm-devel
Fixes:
warning: passing a unit value to a function
--> lib/proxmox-api-types/pve-api-types/src/client/../generated/code.rs:1007:9
|
1007 | Ok(self.0.delete(&url).await?.expect_json()?.data)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
= note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
|
1007 ~ self.0.delete(&url).await?.expect_json()?.data;
1008 + Ok(())
|
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pve-api-types/src/generated/code.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index 3da259b..211e297 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -1004,7 +1004,8 @@ where
/// Stop a task.
async fn stop_task(&self, node: &str, upid: &str) -> Result<(), Error> {
let url = format!("/api2/extjs/nodes/{node}/tasks/{upid}");
- Ok(self.0.delete(&url).await?.expect_json()?.data)
+ self.0.delete(&url).await?.expect_json::<()>()?;
+ Ok(())
}
/// API version details, including some parts of the global datacenter
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] applied: [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
` (2 preceding siblings ...)
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 4/4] generated code: Do not return unit value Maximiliano Sandoval
@ 2025-01-13 12:21 ` Dietmar Maurer
3 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2025-01-13 12:21 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Maximiliano Sandoval
applied all 4 patches
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format!
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format! Maximiliano Sandoval
@ 2025-01-14 13:21 ` Wolfgang Bumiller
0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Bumiller @ 2025-01-14 13:21 UTC (permalink / raw)
To: Maximiliano Sandoval; +Cc: pdm-devel
Please don't patch code which, as indicated, is *generated*.
Patch the generator instead.
This change will be reverted automatically every time the code gets updated.
On Mon, Jan 13, 2025 at 01:12:23PM +0100, Maximiliano Sandoval wrote:
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
> pve-api-types/src/generated/code.rs | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
> index dc17cd9..3da259b 100644
> --- a/pve-api-types/src/generated/code.rs
> +++ b/pve-api-types/src/generated/code.rs
> @@ -764,8 +764,8 @@ where
>
> /// Authentication domain index.
> async fn list_domains(&self) -> Result<Vec<ListRealm>, Error> {
> - let url = format!("/api2/extjs/access/domains");
> - Ok(self.0.get(&url).await?.expect_json()?.data)
> + let url = "/api2/extjs/access/domains";
> + Ok(self.0.get(url).await?.expect_json()?.data)
> }
>
> /// LXC container index (per node).
> @@ -788,8 +788,8 @@ where
>
> /// Cluster node index.
> async fn list_nodes(&self) -> Result<Vec<ClusterNodeIndexResponse>, Error> {
> - let url = format!("/api2/extjs/nodes");
> - Ok(self.0.get(&url).await?.expect_json()?.data)
> + let url = "/api2/extjs/nodes";
> + Ok(self.0.get(url).await?.expect_json()?.data)
> }
>
> /// Virtual machine index (per node).
> @@ -1010,7 +1010,7 @@ where
> /// API version details, including some parts of the global datacenter
> /// config.
> async fn version(&self) -> Result<VersionResponse, Error> {
> - let url = format!("/api2/extjs/version");
> - Ok(self.0.get(&url).await?.expect_json()?.data)
> + let url = "/api2/extjs/version";
> + Ok(self.0.get(url).await?.expect_json()?.data)
> }
> }
> --
> 2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-14 13:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format! Maximiliano Sandoval
2025-01-14 13:21 ` Wolfgang Bumiller
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 4/4] generated code: Do not return unit value Maximiliano Sandoval
2025-01-13 12:21 ` [pdm-devel] applied: [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Dietmar Maurer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox