tree-wide: fix needless borrows

found and fixed via clippy

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-12-30 12:57:37 +01:00
parent 8393bcb268
commit 647a0db882
2 changed files with 5 additions and 5 deletions

View File

@ -241,7 +241,7 @@ fn get_proxied_peer(headers: &HeaderMap) -> Option<std::net::SocketAddr> {
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()

View File

@ -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();
}
}