[pbs-devel] [PATCH backup 03/13] backup_manager: use Vec::first instead of get(0)

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Dec 2 10:57:58 CET 2024


Fixes the get_first clippy lint:

```
warning: accessing first element with `matching_stores.get(0)`
   --> src/bin/proxmox_backup_manager/datastore.rs:284:26
    |
284 |     if let Some(store) = matching_stores.get(0) {
    |                          ^^^^^^^^^^^^^^^^^^^^^^ help: try: `matching_stores.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/bin/proxmox_backup_manager/datastore.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
index 8711997de..0918af3a4 100644
--- a/src/bin/proxmox_backup_manager/datastore.rs
+++ b/src/bin/proxmox_backup_manager/datastore.rs
@@ -281,7 +281,7 @@ async fn uuid_mount(param: Value, _rpcenv: &mut dyn RpcEnvironment) -> Result<Va
         return Ok(Value::Null);
     }
 
-    if let Some(store) = matching_stores.get(0) {
+    if let Some(store) = matching_stores.first() {
         api2::admin::datastore::do_mount_device(store.clone())?;
     }
 
-- 
2.39.5





More information about the pbs-devel mailing list