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 b92cad0938
commit e062ebbc29
18 changed files with 36 additions and 36 deletions

View File

@ -1493,7 +1493,7 @@ fn pxar_file_download(
let mut split = components.splitn(2, |c| *c == b'/');
let pxar_name = std::str::from_utf8(split.next().unwrap())?;
let file_path = split.next().ok_or(format_err!("filepath looks strange '{}'", filepath))?;
let file_path = split.next().ok_or_else(|| format_err!("filepath looks strange '{}'", filepath))?;
let (manifest, files) = read_backup_index(&datastore, &backup_dir)?;
for file in files {
if file.filename == pxar_name && file.crypt_mode == Some(CryptMode::Encrypt) {
@ -1520,7 +1520,7 @@ fn pxar_file_download(
let root = decoder.open_root().await?;
let file = root
.lookup(OsStr::from_bytes(file_path)).await?
.ok_or(format_err!("error opening '{:?}'", file_path))?;
.ok_or_else(|| format_err!("error opening '{:?}'", file_path))?;
let body = match file.kind() {
EntryKind::File { .. } => Body::wrap_stream(