mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
sdk/crypto/util.rs: replace ugly CtOption mess with cleaner version using .into() and match
This commit is contained in:
@@ -107,11 +107,9 @@ pub trait FieldElemAsStr: PrimeField<Repr = [u8; 32]> {
|
||||
let mut bytes = decode_hex_arr(hex)?;
|
||||
bytes.reverse();
|
||||
|
||||
let value = Self::from_repr(bytes);
|
||||
if value.is_some().into() {
|
||||
Ok(value.unwrap())
|
||||
} else {
|
||||
Err(ContractError::HexFmtErr)
|
||||
match Self::from_repr(bytes).into() {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ContractError::HexFmtErr),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user