Address various clippy warnings/errors in zcash_primitives

This commit is contained in:
Jack Grigg
2019-08-24 00:39:49 +01:00
parent d65fe2cda9
commit 3a8efd9e67
18 changed files with 97 additions and 107 deletions
+6 -6
View File
@@ -132,9 +132,9 @@ impl<E: JubjubEngine> Point<E, Unknown> {
t.mul_assign(&y);
Some(Point {
x: x,
y: y,
t: t,
x,
y,
t,
z: E::Fr::one(),
_marker: PhantomData,
})
@@ -277,8 +277,8 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
Point {
x: u,
y: v,
t: t,
z: z,
t,
z,
_marker: PhantomData,
}
}
@@ -412,7 +412,7 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
b.mul_assign(&other.y);
// C = d * t1 * t2
let mut c = params.edwards_d().clone();
let mut c = *params.edwards_d();
c.mul_assign(&self.t);
c.mul_assign(&other.t);
+2 -2
View File
@@ -321,8 +321,8 @@ impl Field for Fs {
loop {
let mut tmp = {
let mut repr = [0u64; 4];
for i in 0..4 {
repr[i] = rng.next_u64();
for limb in &mut repr {
*limb = rng.next_u64();
}
Fs(FsRepr(repr))
};
+2 -2
View File
@@ -199,9 +199,9 @@ impl JubjubBls12 {
)
.unwrap(),
// A = 40962
montgomery_a: montgomery_a,
montgomery_a,
// 2A = 2.A
montgomery_2a: montgomery_2a,
montgomery_2a,
// scaling factor = sqrt(4 / (a - d))
scale: Fr::from_str(
"17814886934372412843466061268024708274627479829237077604635722030778476050649",
+7 -8
View File
@@ -64,12 +64,12 @@ impl<E: JubjubEngine> Point<E, Unknown> {
y.negate();
}
return Some(Point {
x: x,
y: y,
Some(Point {
x,
y,
infinity: false,
_marker: PhantomData,
});
})
}
None => None,
}
@@ -88,9 +88,8 @@ impl<E: JubjubEngine> Point<E, Unknown> {
let x = E::Fr::random(rng);
let sign = rng.next_u32() % 2 != 0;
match Self::get_for_x(x, sign, params) {
Some(p) => return p,
None => {}
if let Some(p) = Self::get_for_x(x, sign, params) {
return p;
}
}
}
@@ -214,7 +213,7 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
let mut delta = E::Fr::one();
{
let mut tmp = params.montgomery_a().clone();
let mut tmp = *params.montgomery_a();
tmp.mul_assign(&self.x);
tmp.double();
delta.add_assign(&tmp);