diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-21 17:42:27 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:04 +0300 |
commit | bc7992d35667ed05dc59c5876372f785df97c63b (patch) | |
tree | 831041552f150880f76ad74895bb2185f913b6df | |
parent | 0ffd43b786807c26d1bf95426b12900610ded699 (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.
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.rs | 4 |
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. |