From a6947d6d21858d5036da976151dbb38b2b99fdf5 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Thu, 7 Dec 2023 09:32:48 -0500 Subject: [PATCH] bulletproofs: avoid `mut` --- coins/monero/src/ringct/bulletproofs/core.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/coins/monero/src/ringct/bulletproofs/core.rs b/coins/monero/src/ringct/bulletproofs/core.rs index a3428bb8..6c264e00 100644 --- a/coins/monero/src/ringct/bulletproofs/core.rs +++ b/coins/monero/src/ringct/bulletproofs/core.rs @@ -78,10 +78,8 @@ pub(crate) fn bit_decompose(commitments: &[Commitment]) -> (ScalarVector, Scalar for j in 0 .. M { for i in (0 .. N).rev() { - let mut bit = Choice::from(0); - if j < sv.len() { - bit = Choice::from((sv[j][i / 8] >> (i % 8)) & 1); - } + let bit = + if j < sv.len() { Choice::from((sv[j][i / 8] >> (i % 8)) & 1) } else { Choice::from(0) }; aL.0[(j * N) + i] = Scalar::conditional_select(&Scalar::ZERO, &Scalar::ONE, bit); aR.0[(j * N) + i] = Scalar::conditional_select(&-Scalar::ONE, &Scalar::ZERO, bit); }