From bb7018e183f5abdab22ca183caae15ce9fa138c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 8 Feb 2022 14:57:16 +0100 Subject: [PATCH] misc clippy fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the trivial ones ;) Signed-off-by: Fabian Grünbichler --- proxmox-rest-server/examples/minimal-rest-server.rs | 2 +- proxmox-rest-server/src/api_config.rs | 4 ++-- proxmox-rest-server/src/lib.rs | 2 +- proxmox-rest-server/src/rest.rs | 2 +- proxmox-rest-server/src/worker_task.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proxmox-rest-server/examples/minimal-rest-server.rs b/proxmox-rest-server/examples/minimal-rest-server.rs index 1ddcfeb8..7dd6fbcf 100644 --- a/proxmox-rest-server/examples/minimal-rest-server.rs +++ b/proxmox-rest-server/examples/minimal-rest-server.rs @@ -80,7 +80,7 @@ lazy_static! { #[api] /// Lists all current items fn list_items() -> Result, Error> { - Ok(ITEM_MAP.lock().unwrap().keys().map(|k| k.clone()).collect()) + Ok(ITEM_MAP.lock().unwrap().keys().cloned().collect()) } #[api( diff --git a/proxmox-rest-server/src/api_config.rs b/proxmox-rest-server/src/api_config.rs index 4c56f657..ad76a15f 100644 --- a/proxmox-rest-server/src/api_config.rs +++ b/proxmox-rest-server/src/api_config.rs @@ -206,7 +206,7 @@ impl ApiConfig { let logger_options = FileLogOptions { append: true, - file_opts: file_opts.unwrap_or(CreateOptions::default()), + file_opts: file_opts.unwrap_or_default(), ..Default::default() }; let request_log = Arc::new(Mutex::new(FileLogger::new(&path, logger_options)?)); @@ -246,7 +246,7 @@ impl ApiConfig { let logger_options = FileLogOptions { append: true, prefix_time: true, - file_opts: file_opts.unwrap_or(CreateOptions::default()), + file_opts: file_opts.unwrap_or_default(), ..Default::default() }; let auth_log = Arc::new(Mutex::new(FileLogger::new(&path, logger_options)?)); diff --git a/proxmox-rest-server/src/lib.rs b/proxmox-rest-server/src/lib.rs index 3f7afae6..a20d9070 100644 --- a/proxmox-rest-server/src/lib.rs +++ b/proxmox-rest-server/src/lib.rs @@ -205,7 +205,7 @@ pub fn extract_cookie(cookie: &str, cookie_name: &str) -> Option { /// We assume cookie_name is already url encoded. pub fn cookie_from_header(headers: &http::HeaderMap, cookie_name: &str) -> Option { if let Some(Ok(cookie)) = headers.get("COOKIE").map(|v| v.to_str()) { - extract_cookie(&cookie, cookie_name) + extract_cookie(cookie, cookie_name) } else { None } diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs index 3f846cc6..093e6226 100644 --- a/proxmox-rest-server/src/rest.rs +++ b/proxmox-rest-server/src/rest.rs @@ -377,7 +377,7 @@ async fn get_request_parameters( } } param_schema.verify_json(¶ms)?; - return Ok(params); + Ok(params) } else { parse_query_parameters(param_schema, utf8_data, &parts, &uri_param) } diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs index 712ed04e..643e1872 100644 --- a/proxmox-rest-server/src/worker_task.rs +++ b/proxmox-rest-server/src/worker_task.rs @@ -901,7 +901,7 @@ impl WorkerTask { pub fn request_abort(&self) { let prev_abort = self.abort_requested.swap(true, Ordering::SeqCst); if !prev_abort { // log abort one time - self.log_message(format!("received abort request ...")); + self.log_message("received abort request ...".to_string()); } // noitify listeners let mut data = self.data.lock().unwrap();