diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-27 14:55:07 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:09 +0300 |
commit | b7ebecb5e98c2eb2103f8dab0bc609e2aeb63632 (patch) | |
tree | 98a239c8f572b8ea8ca5e3c5b3de69b16df4dd9e /sq | |
parent | 2c87795bd765f50363cdee71013848b1c3138604 (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.
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/decrypt.rs | 6 |
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."); |