[pbs-devel] [PATCH proxmox 03/10] apt: repositories: use if-let instead of match for Option
Maximiliano Sandoval
m.sandoval at proxmox.com
Tue Dec 3 11:20:31 CET 2024
Fixes the single_match clippy lint:
```
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> proxmox-apt/src/repositories/mod.rs:41:9
|
41 | / match digest {
42 | | Some(digest) => common_raw.extend_from_slice(&digest[..]),
43 | | None => (),
44 | | }
| |_________^ help: try: `if let Some(digest) = digest { common_raw.extend_from_slice(&digest[..]) }`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
```
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
proxmox-apt/src/repositories/mod.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/proxmox-apt/src/repositories/mod.rs b/proxmox-apt/src/repositories/mod.rs
index a3e876ee..4c954668 100644
--- a/proxmox-apt/src/repositories/mod.rs
+++ b/proxmox-apt/src/repositories/mod.rs
@@ -38,9 +38,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> ConfigDigest {
let mut common_raw = Vec::<u8>::with_capacity(digests.len() * 32);
for digest in digests.values() {
- match digest {
- Some(digest) => common_raw.extend_from_slice(&digest[..]),
- None => (),
+ if let Some(digest) = digest {
+ common_raw.extend_from_slice(&digest[..]);
}
}
--
2.39.5
More information about the pbs-devel
mailing list