public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match
@ 2024-12-03 10:20 Maximiliano Sandoval
  2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2024-12-03 10:20 UTC (permalink / raw)
  To: pbs-devel

Fixes the manual_unwrap_or_default clippy lint:

```
warning: match can be simplified with `.unwrap_or_default()`
   --> proxmox-apt/src/repositories/file.rs:369:30
    |
369 |               let mut origin = match repo.get_cached_origin(apt_lists_dir) {
    |  ______________________________^
370 | |                 Ok(option) => option,
371 | |                 Err(_) => None,
372 | |             };
    | |_____________^ help: replace it with: `repo.get_cached_origin(apt_lists_dir).unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
    = note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
```

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-apt/src/repositories/file.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/proxmox-apt/src/repositories/file.rs b/proxmox-apt/src/repositories/file.rs
index f176ab71..e34e84e0 100644
--- a/proxmox-apt/src/repositories/file.rs
+++ b/proxmox-apt/src/repositories/file.rs
@@ -366,10 +366,7 @@ impl APTRepositoryFileImpl for APTRepositoryFile {
         };
 
         for (n, repo) in self.repositories.iter().enumerate() {
-            let mut origin = match repo.get_cached_origin(apt_lists_dir) {
-                Ok(option) => option,
-                Err(_) => None,
-            };
+            let mut origin = repo.get_cached_origin(apt_lists_dir).unwrap_or_default();
 
             if origin.is_none() {
                 origin = repo.origin_from_uris();
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-12-03 13:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 10:20 [pbs-devel] [PATCH proxmox 01/10] apt: file: Use unwrap_or_default instead of match Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 02/10] api: webhook: doc: add indentation to list item Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 04/10] router: parsing: docs: fix Records::from link Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 05/10] router: parsing: docs: fix 'instead' typo Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 06/10] elide lifetimes where possible Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 07/10] remove unnecessary return statement Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 08/10] docs: remove empty lines in docs Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 09/10] sys: systemd: remove empty line after outer attribute Maximiliano Sandoval
2024-12-03 10:20 ` [pbs-devel] [PATCH proxmox 10/10] apt: repositories: remove unnecessary if-let in iterator Maximiliano Sandoval
2024-12-03 13:30   ` [pbs-devel] applied-seires: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal