[pbs-devel] [PATCH proxmox 2/2] tree-wide: clippy fixes
Lukas Wagner
l.wagner at proxmox.com
Tue Dec 5 13:31:15 CET 2023
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
proxmox-acme/src/order.rs | 9 ++-------
proxmox-api-macro/src/util.rs | 2 +-
proxmox-rest-server/src/rest.rs | 2 +-
proxmox-rest-server/src/worker_task.rs | 2 +-
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/proxmox-acme/src/order.rs b/proxmox-acme/src/order.rs
index 404d4ae..97c068c 100644
--- a/proxmox-acme/src/order.rs
+++ b/proxmox-acme/src/order.rs
@@ -7,11 +7,12 @@ use crate::request::Request;
use crate::Error;
/// Status of an [`Order`].
-#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Status {
/// Invalid, used as a place holder for when sending objects as contrary to account creation,
/// the Acme RFC does not require the server to ignore unknown parts of the `Order` object.
+ #[default]
New,
/// Authorization failed and it is now invalid.
@@ -33,12 +34,6 @@ pub enum Status {
Valid,
}
-impl Default for Status {
- fn default() -> Self {
- Status::New
- }
-}
-
impl Status {
/// Serde helper
fn is_new(&self) -> bool {
diff --git a/proxmox-api-macro/src/util.rs b/proxmox-api-macro/src/util.rs
index 324c460..428b1e4 100644
--- a/proxmox-api-macro/src/util.rs
+++ b/proxmox-api-macro/src/util.rs
@@ -865,7 +865,7 @@ pub fn parse_str_value_to_option<T: Parse>(
path: &syn::Path,
nv: syn::parse::ParseStream<'_>,
) {
- duplicate(&*target, &path);
+ duplicate(&*target, path);
match nv.parse().and_then(|lit| parse_lit_str(&lit)) {
Ok(value) => *target = Some(value),
Err(err) => crate::add_error(err),
diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs
index 39f98e5..25cafb2 100644
--- a/proxmox-rest-server/src/rest.rs
+++ b/proxmox-rest-server/src/rest.rs
@@ -155,7 +155,7 @@ impl Service<Request<Body>> for RedirectService {
Response::builder()
.status(status_code)
- .header("Location", String::from(location_value))
+ .header("Location", location_value)
.body(Body::empty())?
} else {
Response::builder()
diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs
index 4cf24cc..5bab4cd 100644
--- a/proxmox-rest-server/src/worker_task.rs
+++ b/proxmox-rest-server/src/worker_task.rs
@@ -850,7 +850,7 @@ impl WorkerTask {
file_opts: setup.file_opts.clone(),
..Default::default()
};
- let logger = FileLogger::new(&path, logger_options)?;
+ let logger = FileLogger::new(path, logger_options)?;
let worker = Arc::new(Self {
setup,
--
2.39.2
More information about the pbs-devel
mailing list