Correcting some trivial Rust option/iterator warts

This commit is contained in:
François Garillot
2020-01-16 07:36:29 -08:00
parent 18aceea225
commit 865275e2a2
9 changed files with 37 additions and 70 deletions

View File

@@ -89,10 +89,8 @@ impl<E: JubjubEngine> Point<E, Unknown> {
y_repr.as_mut()[3] &= 0x7fffffffffffffff;
match E::Fr::from_repr(y_repr) {
Ok(y) => match Self::get_for_y(y, x_sign, params) {
Some(p) => Ok(p),
None => Err(io::Error::new(io::ErrorKind::InvalidInput, "not on curve")),
},
Ok(y) => Self::get_for_y(y, x_sign, params)
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "not on curve")),
Err(_) => Err(io::Error::new(
io::ErrorKind::InvalidInput,
"y is not in field",