summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-27 14:55:07 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:09 +0300
commitb7ebecb5e98c2eb2103f8dab0bc609e2aeb63632 (patch)
tree98a239c8f572b8ea8ca5e3c5b3de69b16df4dd9e
parent2c87795bd765f50363cdee71013848b1c3138604 (diff)
Simplify tests for OK
Instead of this: if let Some(()) = key.secret_mut().decrypt_in_place(algo, &p).ok() { ... } use this: if key.secret_mut().decrypt_in_place(algo, &p).is_ok() { ... } It's more to the point and easier to understand.
-rw-r--r--sq/src/commands/decrypt.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/sq/src/commands/decrypt.rs b/sq/src/commands/decrypt.rs
index 45e2b4e7..0d874a3b 100644
--- a/sq/src/commands/decrypt.rs
+++ b/sq/src/commands/decrypt.rs
@@ -171,8 +171,7 @@ impl<'a> DecryptionHelper for Helper<'a> {
self.key_hints.get(&keyid).unwrap())))?.into();
let algo = key.pk_algo();
- if let Some(()) =
- key.secret_mut().decrypt_in_place(algo, &p).ok() {
+ if key.secret_mut().decrypt_in_place(algo, &p).is_ok() {
break key.clone().into_keypair().unwrap()
} else {
eprintln!("Bad password.");
@@ -230,8 +229,7 @@ impl<'a> DecryptionHelper for Helper<'a> {
self.key_hints.get(&keyid).unwrap())))?.into();
let algo = key.pk_algo();
- if let Some(()) =
- key.secret_mut().decrypt_in_place(algo, &p).ok() {
+ if key.secret_mut().decrypt_in_place(algo, &p).is_ok() {
break key.clone().into_keypair().unwrap()
} else {
eprintln!("Bad password.");