5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-03 01:18:02 +03:00

push: use unwrap_or to prevent lazy evaluation

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@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-12-02 10:57:59 +01:00 committed by Fabian Grünbichler
parent de44cb7b47
commit c68117d0a1

View File

@ -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| {