* [pbs-devel] [PATCH proxmox 1/2] tree-wide: format code using `cargo fmt` @ 2023-12-05 12:31 Lukas Wagner 2023-12-05 12:31 ` [pbs-devel] [PATCH proxmox 2/2] tree-wide: clippy fixes Lukas Wagner 0 siblings, 1 reply; 2+ messages in thread From: Lukas Wagner @ 2023-12-05 12:31 UTC (permalink / raw) To: pbs-devel Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> --- proxmox-login/src/ticket.rs | 4 ++-- proxmox-notify/src/lib.rs | 13 ++++++++++--- proxmox-rest-server/src/formatter.rs | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/proxmox-login/src/ticket.rs b/proxmox-login/src/ticket.rs index b37952c..9543b70 100644 --- a/proxmox-login/src/ticket.rs +++ b/proxmox-login/src/ticket.rs @@ -240,12 +240,12 @@ impl Authentication { } } -#[cfg(target_arch="wasm32")] +#[cfg(target_arch = "wasm32")] fn epoch_i64() -> i64 { (js_sys::Date::now() / 1000.0) as i64 } -#[cfg(not(target_arch="wasm32"))] +#[cfg(not(target_arch = "wasm32"))] fn epoch_i64() -> i64 { use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs index 1fb9623..3f97332 100644 --- a/proxmox-notify/src/lib.rs +++ b/proxmox-notify/src/lib.rs @@ -278,14 +278,21 @@ impl Config { if let Some(obj) = value.as_object_mut() { obj.insert("origin".to_string(), Value::String("builtin".into())); } else { - log::error!("section config entry is not an object. This should not happen"); + log::error!( + "section config entry is not an object. This should not happen" + ); } } else { // Entry is built-in, but it has been modified by the user. if let Some(obj) = value.as_object_mut() { - obj.insert("origin".to_string(), Value::String("modified-builtin".into())); + obj.insert( + "origin".to_string(), + Value::String("modified-builtin".into()), + ); } else { - log::error!("section config entry is not an object. This should not happen"); + log::error!( + "section config entry is not an object. This should not happen" + ); } } } else { diff --git a/proxmox-rest-server/src/formatter.rs b/proxmox-rest-server/src/formatter.rs index d19d680..793d6b1 100644 --- a/proxmox-rest-server/src/formatter.rs +++ b/proxmox-rest-server/src/formatter.rs @@ -223,7 +223,10 @@ impl OutputFormatter for ExtJsFormatter { for (name, err) in param_err { errors.insert(name, err.to_string()); } - (String::from("parameter verification errors"), StatusCode::BAD_REQUEST) + ( + String::from("parameter verification errors"), + StatusCode::BAD_REQUEST, + ) } Err(err) => (err.to_string(), StatusCode::BAD_REQUEST), } @@ -233,7 +236,7 @@ impl OutputFormatter for ExtJsFormatter { } else { StatusCode::BAD_REQUEST }; - (err.to_string(), status) + (err.to_string(), status) }; let result = json!({ -- 2.39.2 ^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] [PATCH proxmox 2/2] tree-wide: clippy fixes 2023-12-05 12:31 [pbs-devel] [PATCH proxmox 1/2] tree-wide: format code using `cargo fmt` Lukas Wagner @ 2023-12-05 12:31 ` Lukas Wagner 0 siblings, 0 replies; 2+ messages in thread From: Lukas Wagner @ 2023-12-05 12:31 UTC (permalink / raw) To: pbs-devel Signed-off-by: Lukas Wagner <l.wagner@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 ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-05 12:31 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-12-05 12:31 [pbs-devel] [PATCH proxmox 1/2] tree-wide: format code using `cargo fmt` Lukas Wagner 2023-12-05 12:31 ` [pbs-devel] [PATCH proxmox 2/2] tree-wide: clippy fixes Lukas Wagner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox