Fold a few panics

Removes a few panics we don't need by folding them in the Error case of their enclosing Result return.
This commit is contained in:
François Garillot
2020-12-09 13:10:05 -08:00
parent 94630dff7c
commit 6b22064863
4 changed files with 35 additions and 48 deletions
+1 -4
View File
@@ -196,10 +196,7 @@ mod tests {
];
fn deserialize_point(pt: &[u8]) -> Result<EdwardsPoint> {
let bytes: [u8; 32] = (&pt[..32])
.try_into()
.expect("Slice pattern invariant broken");
let bytes: [u8; 32] = (&pt[..32]).try_into()?;
curve25519_dalek::edwards::CompressedEdwardsY(bytes)
.decompress()
.ok_or_else(|| anyhow!("Point decompression failed!"))