[pbs-devel] [PATCH proxmox-backup v2 07/14] pxar: clippy fix `or_fun_call`
Dominik Csapak
d.csapak at proxmox.com
Fri Apr 16 12:29:03 CEST 2021
replace ok_or with ok_or_else to do lazy evaluation
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/pxar/extract.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pxar/extract.rs b/src/pxar/extract.rs
index 16b2b499..b52bc503 100644
--- a/src/pxar/extract.rs
+++ b/src/pxar/extract.rs
@@ -517,7 +517,7 @@ where
let root = decoder.open_root().await?;
let file = root
.lookup(&path).await?
- .ok_or(format_err!("error opening '{:?}'", path.as_ref()))?;
+ .ok_or_else(|| format_err!("error opening '{:?}'", path.as_ref()))?;
let mut prefix = PathBuf::new();
let mut components = file.entry().path().components();
@@ -668,7 +668,7 @@ where
let file = root
.lookup(&path)
.await?
- .ok_or(format_err!("error opening '{:?}'", path.as_ref()))?;
+ .ok_or_else(|| format_err!("error opening '{:?}'", path.as_ref()))?;
recurse_files_extractor(&mut extractor, file, verbose).await
}
--
2.20.1
More information about the pbs-devel
mailing list