Remove a few unnecessary clones

This commit is contained in:
François Garillot
2019-12-02 07:26:52 -08:00
committed by Pratyush Mishra
parent d71bc5a675
commit c42c7dd98a
5 changed files with 10 additions and 10 deletions

View File

@@ -180,7 +180,7 @@ where
P::miller_loop(
cs.ns(|| "Miller loop 4"),
&[a_prep, pvk.g_gamma_pc.clone()],
&[pvk.h_gamma_pc.clone(), b_prep],
&[pvk.h_gamma_pc, b_prep],
)?
};
let test2 = P::final_exponentiation(cs.ns(|| "Final Exp 2"), &test2_exp)?;

View File

@@ -76,8 +76,8 @@ impl<P: Fp2Parameters<Fp = ConstraintF>, ConstraintF: PrimeField> FieldGadget<Fp
#[inline]
fn get_variable(&self) -> Self::Variable {
(
self.c0.get_variable().clone(),
self.c1.get_variable().clone(),
self.c0.get_variable(),
self.c1.get_variable(),
)
}

View File

@@ -39,7 +39,7 @@ impl<P: Bls12Parameters> PairingGadget<P> {
TwistType::M => {
let c0 = coeffs.0.clone();
let mut c1 = coeffs.1.clone();
let c2 = Fp2G::<P>::new(p.y.clone(), zero.clone());
let c2 = Fp2G::<P>::new(p.y.clone(), zero);
c1.c0 = c1.c0.mul(cs.ns(|| "mul c1.c0"), &p.x)?;
c1.c1 = c1.c1.mul(cs.ns(|| "mul c1.c1"), &p.x)?;
@@ -47,7 +47,7 @@ impl<P: Bls12Parameters> PairingGadget<P> {
Ok(())
},
TwistType::D => {
let c0 = Fp2G::<P>::new(p.y.clone(), zero.clone());
let c0 = Fp2G::<P>::new(p.y.clone(), zero);
let mut c1 = coeffs.0.clone();
let c2 = coeffs.1.clone();

View File

@@ -108,7 +108,7 @@ mod test {
let (ans1_g, ans1_n) = {
let ans_g = PairingGadget::pairing(
cs.ns(|| "pair(sa, b)"),
sa_prep_g.clone(),
sa_prep_g,
b_prep_g.clone(),
)
.unwrap();
@@ -120,7 +120,7 @@ mod test {
let ans_g = PairingGadget::pairing(
cs.ns(|| "pair(a, sb)"),
a_prep_g.clone(),
sb_prep_g.clone(),
sb_prep_g,
)
.unwrap();
let ans_n = Bls12_377::pairing(a, sb);
@@ -129,11 +129,11 @@ mod test {
let (ans3_g, ans3_n) = {
let s_iter = BitIterator::new(s.into_repr())
.map(|bit| Boolean::constant(bit))
.map(Boolean::constant)
.collect::<Vec<_>>();
let mut ans_g =
PairingGadget::pairing(cs.ns(|| "pair(a, b)"), a_prep_g.clone(), b_prep_g.clone())
PairingGadget::pairing(cs.ns(|| "pair(a, b)"), a_prep_g, b_prep_g)
.unwrap();
let mut ans_n = Bls12_377::pairing(a, b);
ans_n = ans_n.pow(s.into_repr());

View File

@@ -212,7 +212,7 @@ impl<ConstraintF: Field> ConstraintSystem<ConstraintF> for TestConstraintSystem<
{
let name = name_fn().into();
let path = compute_path(&self.current_namespace, name.clone());
self.set_named_obj(path.clone(), NamedObject::Namespace);
self.set_named_obj(path, NamedObject::Namespace);
self.current_namespace.push(name);
}