[pbs-devel] [PATCH backup 04/13] push: use unwrap_or to prevent lazy evaluation
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Dec 2 10:57:59 CET 2024
Fixes the unnecessary_lazy_evaluations clippy lint:
```
warning: unnecessary closure used to substitute value for `Option::None`
--> src/server/push.rs:445:25
|
445 | let max_depth = params
| _________________________^
446 | | .max_depth
447 | | .unwrap_or_else(|| pbs_api_types::MAX_NAMESPACE_DEPTH);
| |__________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `unwrap_or` instead
|
447 | .unwrap_or(pbs_api_types::MAX_NAMESPACE_DEPTH);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
src/server/push.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/server/push.rs b/src/server/push.rs
index 8f654d4b4..b2639526b 100644
--- a/src/server/push.rs
+++ b/src/server/push.rs
@@ -444,7 +444,7 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
// Without this pre-filtering, all namespaces unrelated to the sync would be removed!
let max_depth = params
.max_depth
- .unwrap_or_else(|| pbs_api_types::MAX_NAMESPACE_DEPTH);
+ .unwrap_or(pbs_api_types::MAX_NAMESPACE_DEPTH);
let mut target_sub_namespaces: Vec<BackupNamespace> = existing_target_namespaces
.into_iter()
.filter(|target_namespace| {
--
2.39.5
More information about the pbs-devel
mailing list