From bc7992d35667ed05dc59c5876372f785df97c63b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 21 Sep 2021 17:42:27 +0300 Subject: 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 --- store/src/backend/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'store') 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. -- cgit v1.2.3