clippy: us *_or_else with function calls

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-01-19 14:04:46 +01:00
parent 724e2f47f9
commit ba81db7848

View File

@ -147,7 +147,7 @@ fn log_response(
let now = proxmox::tools::time::epoch_i64(); let now = proxmox::tools::time::epoch_i64();
// time format which apache/nginx use (by default), copied from pve-http-server // time format which apache/nginx use (by default), copied from pve-http-server
let datetime = proxmox::tools::time::strftime_local("%d/%m/%Y:%H:%M:%S %z", now) let datetime = proxmox::tools::time::strftime_local("%d/%m/%Y:%H:%M:%S %z", now)
.unwrap_or("-".into()); .unwrap_or_else(|_| "-".to_string());
logfile logfile
.lock() .lock()
@ -161,7 +161,7 @@ fn log_response(
path, path,
status.as_str(), status.as_str(),
resp.body().size_hint().lower(), resp.body().size_hint().lower(),
user_agent.unwrap_or("-".into()), user_agent.unwrap_or_else(|| "-".to_string()),
)); ));
} }
} }