From ea3344585b28f5b5449d90b718f1c64929768937 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Tue, 22 Nov 2022 14:30:29 +0200 Subject: [PATCH] fix: remove 2 unnecessary allocations in batch_mul (#154) --- src/ristretto/ristretto_keys.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ristretto/ristretto_keys.rs b/src/ristretto/ristretto_keys.rs index 9ce7d72e..c2f9c0fe 100644 --- a/src/ristretto/ristretto_keys.rs +++ b/src/ristretto/ristretto_keys.rs @@ -332,8 +332,8 @@ impl PublicKey for RistrettoPublicKey { } fn batch_mul(scalars: &[Self::K], points: &[Self]) -> Self { - let p: Vec<&RistrettoPoint> = points.iter().map(|p| &p.point).collect(); - let s: Vec<&Scalar> = scalars.iter().map(|k| &k.0).collect(); + let p = points.iter().map(|p| &p.point); + let s = scalars.iter().map(|k| &k.0); let p = RistrettoPoint::multiscalar_mul(s, p); RistrettoPublicKey::new_from_pk(p) }