[pbs-devel] [PATCH backup 12/13] datastore: simplify let-else block with ? operator
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Dec 2 10:58:07 CET 2024
Fixes the question_mark clippy lint:
```
warning: this `let...else` may be rewritten with the `?` operator
--> pbs-datastore/src/datastore.rs:101:5
|
101 | / let Some(ref device_uuid) = config.backing_device else {
102 | | return None;
103 | | };
| |______^ help: replace it with: `let ref device_uuid = config.backing_device?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
= note: `#[warn(clippy::question_mark)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
pbs-datastore/src/datastore.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 24d9eab2e..cf55befaa 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -98,9 +98,7 @@ fn is_datastore_mounted_at(store_mount_point: String, device_uuid: &str) -> bool
}
pub fn get_datastore_mount_status(config: &DataStoreConfig) -> Option<bool> {
- let Some(ref device_uuid) = config.backing_device else {
- return None;
- };
+ let device_uuid = config.backing_device.as_ref()?;
Some(is_datastore_mounted_at(config.absolute_path(), device_uuid))
}
--
2.39.5
More information about the pbs-devel
mailing list