Skip to content

Commit afc19c0

Browse files
authored
ec: small refactor on pairing (#899)
1 parent e741880 commit afc19c0

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

curves/curve-constraint-tests/src/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub mod fields {
2121
AllocationMode::Constant,
2222
];
2323
for &mode in &modes {
24-
let cs = ConstraintSystem::<ConstraintF>::new_ref();
24+
let cs = ConstraintSystem::new_ref();
2525

2626
let mut rng = test_rng();
2727
let a_native = F::rand(&mut rng);
@@ -152,10 +152,7 @@ pub mod fields {
152152
for c in &mut constants {
153153
*c = UniformRand::rand(&mut test_rng());
154154
}
155-
let bits = [
156-
Boolean::<ConstraintF>::constant(false),
157-
Boolean::constant(true),
158-
];
155+
let bits = [Boolean::constant(false), Boolean::constant(true)];
159156
let lookup_result = AF::two_bit_lookup(&bits, constants.as_ref())?;
160157
assert_eq!(lookup_result.value()?, constants[2]);
161158
assert!(cs.is_satisfied().unwrap());

ec/src/pairing.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,10 @@ impl<P: Pairing> Mul<P::ScalarField> for MillerLoopOutput<P> {
333333

334334
/// Preprocesses a G1 element for use in a pairing.
335335
pub fn prepare_g1<E: Pairing>(g: impl Into<E::G1Affine>) -> E::G1Prepared {
336-
let g: E::G1Affine = g.into();
337-
E::G1Prepared::from(g)
336+
E::G1Prepared::from(g.into())
338337
}
339338

340339
/// Preprocesses a G2 element for use in a pairing.
341340
pub fn prepare_g2<E: Pairing>(g: impl Into<E::G2Affine>) -> E::G2Prepared {
342-
let g: E::G2Affine = g.into();
343-
E::G2Prepared::from(g)
341+
E::G2Prepared::from(g.into())
344342
}

0 commit comments

Comments
 (0)