Call '.ok()' on the try_from Result in PublicKey strategy

This commit is contained in:
Deirdre Connolly 2020-05-11 23:36:04 -04:00 committed by Deirdre Connolly
parent 760aa8f5eb
commit 06fddf3fb1
1 changed files with 3 additions and 7 deletions

View File

@ -103,13 +103,9 @@ impl Arbitrary for PublicKey {
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
array::uniform32(any::<u8>())
.prop_filter_map(
"Decompressible Ristretto point",
|b| match PublicKey::try_from(b) {
Ok(public_key) => Some(public_key),
Err(_) => None,
},
)
.prop_filter_map("Decompressible Ristretto point", |b| {
PublicKey::try_from(b).ok()
})
.boxed()
}