From a560101bb2f2c9635aaa8a77256fef0c49a113eb Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Thu, 8 Apr 2021 10:08:00 -0600 Subject: [PATCH] Remove spurious mut references. --- components/zcash_note_encryption/src/lib.rs | 2 +- zcash_primitives/benches/note_decryption.rs | 4 ++-- zcash_primitives/src/sapling/note_encryption.rs | 6 +++--- zcash_primitives/src/transaction/builder.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/zcash_note_encryption/src/lib.rs b/components/zcash_note_encryption/src/lib.rs index 520168098..c4e2d87a7 100644 --- a/components/zcash_note_encryption/src/lib.rs +++ b/components/zcash_note_encryption/src/lib.rs @@ -268,7 +268,7 @@ impl NoteEncryption { /// Generates `outCiphertext` for this note. pub fn encrypt_outgoing_plaintext( - &mut self, + &self, cv: &D::ValueCommitment, cm: &D::NoteCommitment, rng: &mut R, diff --git a/zcash_primitives/benches/note_decryption.rs b/zcash_primitives/benches/note_decryption.rs index f08ef58d9..f9e142ed7 100644 --- a/zcash_primitives/benches/note_decryption.rs +++ b/zcash_primitives/benches/note_decryption.rs @@ -5,7 +5,7 @@ use zcash_primitives::{ consensus::{NetworkUpgrade::Canopy, Parameters, TestNetwork, TEST_NETWORK}, memo::MemoBytes, sapling::{ - note_encryption::{sapling_note_encryption, try_sapling_note_decryption, Memo}, + note_encryption::{sapling_note_encryption, try_sapling_note_decryption}, util::generate_random_rseed, Diversifier, PaymentAddress, SaplingIvk, ValueCommitment, }, @@ -38,7 +38,7 @@ fn bench_note_decryption(c: &mut Criterion) { let note = pa.create_note(value, rseed).unwrap(); let cmu = note.cmu(); - let mut ne = + let ne = sapling_note_encryption::<_, TestNetwork>(None, note, pa, MemoBytes::empty(), &mut rng); let ephemeral_key = *ne.epk(); let enc_ciphertext = ne.encrypt_note_plaintext(); diff --git a/zcash_primitives/src/sapling/note_encryption.rs b/zcash_primitives/src/sapling/note_encryption.rs index daad0e2cd..dd1e2e4dc 100644 --- a/zcash_primitives/src/sapling/note_encryption.rs +++ b/zcash_primitives/src/sapling/note_encryption.rs @@ -554,7 +554,7 @@ mod tests { let cmu = note.cmu(); let ovk = OutgoingViewingKey([0; 32]); - let mut ne = sapling_note_encryption::<_, TestNetwork>( + let ne = sapling_note_encryption::<_, TestNetwork>( Some(ovk), note, pa, @@ -1591,7 +1591,7 @@ mod tests { // Test encryption // - let mut ne = NoteEncryption::>::new_with_esk( + let ne = NoteEncryption::>::new_with_esk( esk, Some(ovk), note, @@ -1599,7 +1599,7 @@ mod tests { MemoBytes::from_bytes(&tv.memo).unwrap(), ); - assert_eq!(&ne.encrypt_note_plaintext().as_ref()[..], &tv.c_enc[..]); + assert_eq!(ne.encrypt_note_plaintext().as_ref(), &tv.c_enc[..]); assert_eq!( &ne.encrypt_outgoing_plaintext(&cv, &cmu, &mut OsRng)[..], &tv.c_out[..] diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index ca3cc2a64..8cdc954d0 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -162,7 +162,7 @@ impl SaplingOutput

{ ctx: &mut Pr::SaplingProvingContext, rng: &mut R, ) -> OutputDescription { - let mut encryptor = sapling_note_encryption::( + let encryptor = sapling_note_encryption::( self.ovk, self.note.clone(), self.to.clone(),