Skip to content

Commit 072c006

Browse files
committed
refactor: do not chain Autocrypt key verification to parsing
.and_then() and Ok() are unnecessary here.
1 parent cb783ff commit 072c006

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/aheader.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ impl FromStr for Aheader {
108108
.remove("keydata")
109109
.context("keydata attribute is not found")
110110
.and_then(|raw| {
111-
SignedPublicKey::from_base64(&raw).context("autocrypt key cannot be decoded")
112-
})
113-
.and_then(|key| {
114-
key.verify_bindings()
115-
.and(Ok(key))
116-
.context("Autocrypt key cannot be verified")
111+
SignedPublicKey::from_base64(&raw).context("Autocrypt key cannot be decoded")
117112
})?;
113+
public_key
114+
.verify_bindings()
115+
.context("Autocrypt key cannot be verified")?;
118116

119117
let prefer_encrypt = attributes
120118
.remove("prefer-encrypt")

0 commit comments

Comments
 (0)