[pbs-devel] [PATCH proxmox-backup 07/12] pxar: clippy fix `or_fun_call`

Dominik Csapak d.csapak at proxmox.com
Tue Apr 6 08:27:42 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 32796837..d04ea383 100644
--- a/src/pxar/extract.rs
+++ b/src/pxar/extract.rs
@@ -518,7 +518,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();
@@ -653,7 +653,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, &mut decoder, file, verbose).await
 }
-- 
2.20.1






More information about the pbs-devel mailing list