From 647a0db882d54470849fb0d156bef7f8e825445a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 30 Dec 2021 12:57:37 +0100 Subject: [PATCH] tree-wide: fix needless borrows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit found and fixed via clippy Signed-off-by: Fabian Grünbichler --- proxmox-rest-server/src/rest.rs | 2 +- proxmox-rest-server/src/worker_task.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs index d08b4988..3f846cc6 100644 --- a/proxmox-rest-server/src/rest.rs +++ b/proxmox-rest-server/src/rest.rs @@ -241,7 +241,7 @@ fn get_proxied_peer(headers: &HeaderMap) -> Option { static ref RE: Regex = Regex::new(r#"for="([^"]+)""#).unwrap(); } let forwarded = headers.get(header::FORWARDED)?.to_str().ok()?; - let capture = RE.captures(&forwarded)?; + let capture = RE.captures(forwarded)?; let rhost = capture.get(1)?.as_str(); rhost.parse().ok() diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs index febd545a..bcd1d815 100644 --- a/proxmox-rest-server/src/worker_task.rs +++ b/proxmox-rest-server/src/worker_task.rs @@ -151,7 +151,7 @@ impl WorkerTaskSetup { finish_list.sort_unstable_by(|a, b| { match (&a.state, &b.state) { - (Some(s1), Some(s2)) => s1.cmp(&s2), + (Some(s1), Some(s2)) => s1.cmp(s2), (Some(_), None) => std::cmp::Ordering::Less, (None, Some(_)) => std::cmp::Ordering::Greater, _ => a.upid.starttime.cmp(&b.upid.starttime), @@ -170,7 +170,7 @@ impl WorkerTaskSetup { false, )?; for info in &finish_list { - writer.write_all(render_task_line(&info).as_bytes())?; + writer.write_all(render_task_line(info).as_bytes())?; } } @@ -580,7 +580,7 @@ fn render_task_line(info: &TaskListInfo) -> String { fn render_task_list(list: &[TaskListInfo]) -> String { let mut raw = String::new(); for info in list { - raw.push_str(&render_task_line(&info)); + raw.push_str(&render_task_line(info)); } raw } @@ -980,7 +980,7 @@ pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> { /// Request abort of a local worker (if existing and running) pub fn abort_local_worker(upid: UPID) { - if let Some(ref worker) = WORKER_TASK_LIST.lock().unwrap().get(&upid.task_id) { + if let Some(worker) = WORKER_TASK_LIST.lock().unwrap().get(&upid.task_id) { worker.request_abort(); } }