summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-21 17:42:27 +0300
committerLars Wirzenius <liw@liw.fi>2021-09-27 09:35:07 +0300
commitfc7e8c185ed80799ab2998f10f28a4ca0aeb3e57 (patch)
tree863a1f0668d698d13f119a3715c929c91eeb6bc7
parent2478e4a80edb4e96afcadbd1b7093abb2d3270eb (diff)
Unpack value with if let instead of is_some/unwrap
The "if let" is more idiomatic and thus should be easier for Rust programmers to understand. It also avoids to implicit dependency between the if condition and the unwrap, making it slightly less likely to be broken by future changes. Found by clippy lint unnecessary_unrap: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
-rw-r--r--store/src/backend/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/store/src/backend/mod.rs b/store/src/backend/mod.rs
index 2e32e825..4b2db1be 100644
--- a/store/src/backend/mod.rs
+++ b/store/src/backend/mod.rs
@@ -576,8 +576,8 @@ impl node::binding::Server for BindingServer {
}
}
- if current.is_some() {
- new = sry!(current.unwrap().merge_public(new));
+ if let Some(cert) = current {
+ new = sry!(cert.merge_public(new));
}
// Write key back to the database.