Repository: OpenMined/sycret (language: python)

Issue:
Attend Clippy warnings
## Description
There are currently many warnings from clippy if we run something like:

```bash
cargo clippy --all-features --all-targets
```
We should make the pertinent changes to attend them and readjust the GitHub Action workflow to fail on warnings and errors.

## Are you interested in working on this improvement yourself?
- Yes, I am.

## Additional Context
.



Discussion / hints:

Fix patch:
diff --git a/benches/bench_eq.rs b/benches/bench_eq.rs
index bed909e..280a4c3 100644
--- a/benches/bench_eq.rs
+++ b/benches/bench_eq.rs
@@ -2,14 +2,14 @@ use rand::Rng;
 
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use sycret::eq::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 use sycret::{eval, keygen};
 
 pub fn eq_keygen(c: &mut Criterion) {
     let mut rng = rand::thread_rng();
     let aes_keys: [u128; 4] = rng.gen();
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
     c.bench_function("Eq keygen", |b| {
         b.iter(|| EqKey::generate_keypair(black_box(&mut prg)))
     });
@@ -51,7 +51,7 @@ pub fn eq_batch_keygen(c: &mut Criterion) {
 pub fn eq_eval(c: &mut Criterion) {
     let mut rng = rand::thread_rng();
     let aes_keys: [u128; 4] = rng.gen();
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
 
     let (k_a, k_b) = EqKey::generate_keypair(&mut prg);
     let alpha = k_a.alpha_share.wrapping_add(k_b.alpha_share);
diff --git a/benches/bench_le.rs b/benches/bench_le.rs
index 0ea2f24..511233d 100644
--- a/benches/bench_le.rs
+++ b/benches/bench_le.rs
@@ -2,14 +2,14 @@ use rand::Rng;
 
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use sycret::le::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 use sycret::{eval, keygen};
 
 pub fn le_keygen(c: &mut Criterion) {
     let mut rng = rand::thread_rng();
     let aes_keys: [u128; 4] = rng.gen();
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
     c.bench_function("Le keygen", |b| {
         b.iter(|| LeKey::generate_keypair(black_box(&mut prg)))
     });
@@ -51,7 +51,7 @@ pub fn le_batch_keygen(c: &mut Criterion) {
 pub fn le_eval(c: &mut Criterion) {
     let mut rng = rand::thread_rng();
     let aes_keys: [u128; 4] = rng.gen();
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
 
     let (k_a, k_b) = LeKey::generate_keypair(&mut prg);
     let alpha = k_a.alpha_share.wrapping_add(k_b.alpha_share);
diff --git a/src/eq.rs b/src/eq.rs
index e31849b..e87ee8f 100644
--- a/src/eq.rs
+++ b/src/eq.rs
@@ -8,7 +8,7 @@ use std::convert::TryInto;
 use std::slice;
 
 use crate::fss::dpf::{g, generate_cw_from_seeds};
-use crate::stream::{FSSKey, RawKey, PRG};
+use crate::stream::{FSSKey, Prg, RawKey};
 use crate::utils::{bit_decomposition_u32, compute_out};
 use crate::{L, N};
 
@@ -33,7 +33,7 @@ impl RawKey for EqKey {
         // Get a mutable reference.
         let out_ref: &mut [u8; Self::KEY_LEN] = &mut *out_ptr;
         // Write the key.
-        write_key_to_array(&self, out_ref);
+        write_key_to_array(self, out_ref);
     }
 
     unsafe fn from_raw_line(key_pointer: *const u8) -> Self {
@@ -44,7 +44,7 @@ impl RawKey for EqKey {
 }
 
 impl FSSKey for EqKey {
-    fn generate_keypair(prg: &mut impl PRG) -> (Self, Self) {
+    fn generate_keypair(prg: &mut impl Prg) -> (Self, Self) {
         // Thread randomness for parallelization.
         let mut rng = rand::thread_rng();
 
@@ -86,7 +86,7 @@ impl FSSKey for EqKey {
         )
     }
 
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32 {
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32 {
         // Initialize the control bit and the seed.
         assert!((party_id == 0u8) || (party_id == 1u8));
         let mut t_i: u8 = party_id;
diff --git a/src/fss/dif.rs b/src/fss/dif.rs
index fff16b3..8f746be 100644
--- a/src/fss/dif.rs
+++ b/src/fss/dif.rs
@@ -2,7 +2,7 @@
 //! DIF implementation
 //!
 
-use crate::stream::PRG;
+use crate::stream::Prg;
 use crate::utils::{bit_decomposition_u32, compute_out, share_leaf};
 use crate::{L, N};
 use rand::Rng;
@@ -38,13 +38,13 @@ pub struct DIFKeyAlpha1 {
 }
 
 pub trait DIFKey1: Sized {
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32;
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32;
 
-    fn generate_keypair(prg: &mut impl PRG, alpha: u32) -> (Self, Self);
+    fn generate_keypair(prg: &mut impl Prg, alpha: u32) -> (Self, Self);
 }
 
 impl DIFKey1 for DIFKeyAlpha1 {
-    fn generate_keypair(prg: &mut impl PRG, alpha: u32) -> (Self, Self) {
+    fn generate_keypair(prg: &mut impl Prg, alpha: u32) -> (Self, Self) {
         // Thread randomness for parallelization.
         let mut rng = rand::thread_rng();
 
@@ -69,7 +69,7 @@ impl DIFKey1 for DIFKeyAlpha1 {
         )
     }
 
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32 {
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32 {
         assert!((party_id == 0u8) || (party_id == 1u8));
         let mut t_i: u8 = party_id;
         let mut s_i: u128 = self.s;
@@ -104,7 +104,7 @@ impl DIFKey1 for DIFKeyAlpha1 {
     }
 }
 
-pub fn h(prg: &mut impl PRG, seed: u128) -> CorrectionWord {
+pub fn h(prg: &mut impl Prg, seed: u128) -> CorrectionWord {
     assert_eq!(L, 128 / 8);
 
     let out = prg.expand(seed);
@@ -135,7 +135,7 @@ pub fn h(prg: &mut impl PRG, seed: u128) -> CorrectionWord {
 
 /// Internal deterministic function.
 pub fn generate_cw_from_seeds(
-    prg: &mut impl PRG,
+    prg: &mut impl Prg,
     alpha: u32,
     s_a: u128,
     s_b: u128,
diff --git a/src/fss/dpf.rs b/src/fss/dpf.rs
index 54fd1f1..c2beee4 100644
--- a/src/fss/dpf.rs
+++ b/src/fss/dpf.rs
@@ -2,7 +2,7 @@
 //! DPF implementations
 //!
 
-use crate::stream::PRG;
+use crate::stream::Prg;
 use crate::utils::{bit_decomposition_u32, compute_out, share_leaf};
 use crate::{L, N};
 use rand::Rng;
@@ -11,7 +11,7 @@ use rand::Rng;
 /// Deterministic function
 ///
 pub fn generate_cw_from_seeds(
-    prg: &mut impl PRG,
+    prg: &mut impl Prg,
     alpha: u32,
     s_a: u128,
     s_b: u128,
@@ -81,9 +81,9 @@ pub fn generate_cw_from_seeds(
 }
 
 ///
-/// Wrapper around a PRG with expansion factor 2
+/// Wrapper around a Prg with expansion factor 2
 ///
-pub fn g(prg: &mut impl PRG, seed: u128) -> (u128, u8, u128, u8) {
+pub fn g(prg: &mut impl Prg, seed: u128) -> (u128, u8, u128, u8) {
     assert_eq!(L, 128 / 8);
 
     let out = prg.expand(seed);
@@ -107,13 +107,13 @@ pub struct DPFKeyAlpha1 {
 }
 
 pub trait DPFKey1: Sized {
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32;
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32;
 
-    fn generate_keypair(prg: &mut impl PRG, alpha: u32) -> (Self, Self);
+    fn generate_keypair(prg: &mut impl Prg, alpha: u32) -> (Self, Self);
 }
 
 impl DPFKey1 for DPFKeyAlpha1 {
-    fn generate_keypair(prg: &mut impl PRG, alpha: u32) -> (Self, Self) {
+    fn generate_keypair(prg: &mut impl Prg, alpha: u32) -> (Self, Self) {
         // Thread randomness for parallelization.
         let mut rng = rand::thread_rng();
 
@@ -147,7 +147,7 @@ impl DPFKey1 for DPFKeyAlpha1 {
         )
     }
 
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32 {
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32 {
         // Initialize the control bit and the seed.
         assert!((party_id == 0u8) || (party_id == 1u8));
         let mut t_i: u8 = party_id;
diff --git a/src/le.rs b/src/le.rs
index b3946eb..2686095 100644
--- a/src/le.rs
+++ b/src/le.rs
@@ -11,7 +11,7 @@ use std::slice;
 use crate::fss::dif::{
     decompress_word, generate_cw_from_seeds, h, xor_2_words, CompressedCorrectionWord,
 };
-use crate::stream::{FSSKey, RawKey, PRG};
+use crate::stream::{FSSKey, Prg, RawKey};
 use crate::utils::{bit_decomposition_u32, compute_out};
 use crate::{L, N};
 
@@ -48,7 +48,7 @@ impl RawKey for LeKey {
         // Get a mutable reference.
         let out_ref: &mut [u8; Self::KEY_LEN] = &mut *out_ptr;
         // Write the key.
-        write_key_to_array(&self, out_ref);
+        write_key_to_array(self, out_ref);
     }
 
     unsafe fn from_raw_line(key_pointer: *const u8) -> Self {
@@ -59,7 +59,7 @@ impl RawKey for LeKey {
 }
 
 impl FSSKey for LeKey {
-    fn generate_keypair(prg: &mut impl PRG) -> (Self, Self) {
+    fn generate_keypair(prg: &mut impl Prg) -> (Self, Self) {
         // Thread randomness for parallelization.
         let mut rng = rand::thread_rng();
         // TODO: we can replace this randomness by AES-generated randomness and reduce the key size.
@@ -88,7 +88,7 @@ impl FSSKey for LeKey {
         )
     }
 
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32 {
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32 {
         assert!((party_id == 0u8) || (party_id == 1u8));
         let mut t_i: u8 = party_id;
         let mut s_i: u128 = self.s;
diff --git a/src/lib.rs b/src/lib.rs
index 5bd3d24..4f3e500 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::needless_range_loop)]
+
 use rayon::prelude::*;
 
 pub mod eq;
@@ -23,6 +25,7 @@ fn build_params(op_id: usize) -> (usize, usize, usize) {
     (n_aes_keys, keylen, n_aes_streams)
 }
 
+/// # Safety Declare function to be used within C
 #[no_mangle]
 pub unsafe extern "C" fn keygen(
     keys_a_pointer: *mut u8,
@@ -36,7 +39,7 @@ pub unsafe extern "C" fn keygen(
 
     let (n_aes_keys, keylen, n_aes_streams) = build_params(op_id);
 
-    // Harcoded AES-128 keys for MMO
+    // Harcoded AES-128 keys for Mmo
     let mut aes_keys = Vec::new();
     for i in 0..n_aes_keys {
         aes_keys.push(i as u128);
@@ -88,6 +91,7 @@ pub unsafe extern "C" fn keygen(
     key_stream_args.par_iter().for_each(create_keypair);
 }
 
+/// # Safety Declare function to be used within C
 #[no_mangle]
 pub unsafe extern "C" fn eval(
     party_id: usize,
@@ -104,7 +108,7 @@ pub unsafe extern "C" fn eval(
 
     let (n_aes_keys, keylen, n_aes_streams) = build_params(op_id);
 
-    // Harcoded AES-128 keys for MMO
+    // Harcoded AES-128 keys for Mmo
     let mut aes_keys = Vec::new();
     for i in 0..n_aes_keys {
         aes_keys.push(i as u128);
diff --git a/src/stream.rs b/src/stream.rs
index 2ec76c4..ebc9294 100644
--- a/src/stream.rs
+++ b/src/stream.rs
@@ -6,28 +6,30 @@ use std::slice;
 
 use crate::eq::EqKey;
 use crate::le::LeKey;
-use crate::utils::MMO;
+use crate::utils::Mmo;
 use crate::N;
 
 pub trait FSSKey: Sized {
-    fn eval(&self, prg: &mut impl PRG, party_id: u8, x: u32) -> u32;
+    fn eval(&self, prg: &mut impl Prg, party_id: u8, x: u32) -> u32;
 
-    fn generate_keypair(prg: &mut impl PRG) -> (Self, Self);
+    fn generate_keypair(prg: &mut impl Prg) -> (Self, Self);
 }
 
 pub trait RawKey: Sized {
     const KEY_LEN: usize;
 
+    /// # Safety De-referencing raw pointer
     unsafe fn from_raw_line(raw_line_pointer: *const u8) -> Self;
 
+    /// # Safety De-referencing raw pointer
     unsafe fn to_raw_line(&self, raw_line_pointer: *mut u8);
 }
 
-// Keyed PRG
-pub trait PRG {
+// Keyed Prg
+pub trait Prg {
     fn from_slice(key: &[u128]) -> Self;
 
-    fn from_vec(key: &Vec<u128>) -> Self;
+    fn from_vec(key: &[u128]) -> Self;
 
     // NOTE: Rust Stable does not have const generics
     // const expansion_factor: usize;
@@ -38,7 +40,7 @@ pub trait PRG {
 }
 
 pub fn generate_key_stream(
-    aes_keys: &Vec<u128>,
+    aes_keys: &[u128],
     _stream_id: usize,
     stream_length: usize,
     key_a_pointer: usize,
@@ -49,31 +51,32 @@ pub fn generate_key_stream(
     let key_a_p = key_a_pointer as *mut u8;
     let key_b_p = key_b_pointer as *mut u8;
 
-    // TODO: def. Impl PRG.
-    let mut prg = MMO::from_vec(aes_keys);
+    // TODO: def. Impl Prg.
+    let mut prg = Mmo::from_vec(aes_keys);
 
     for line_counter in 0..stream_length {
         if op_id == 0 {
             let (key_a, key_b) = EqKey::generate_keypair(&mut prg);
             let key_len = EqKey::KEY_LEN;
             unsafe {
-                &key_a.to_raw_line(key_a_p.add(key_len * line_counter));
-                &key_b.to_raw_line(key_b_p.add(key_len * line_counter));
+                key_a.to_raw_line(key_a_p.add(key_len * line_counter));
+                key_b.to_raw_line(key_b_p.add(key_len * line_counter));
             }
         } else {
             let (key_a, key_b) = LeKey::generate_keypair(&mut prg);
             let key_len = LeKey::KEY_LEN;
             unsafe {
-                &key_a.to_raw_line(key_a_p.add(key_len * line_counter));
-                &key_b.to_raw_line(key_b_p.add(key_len * line_counter));
+                key_a.to_raw_line(key_a_p.add(key_len * line_counter));
+                key_b.to_raw_line(key_b_p.add(key_len * line_counter));
             }
         }
     }
 }
 
+#[allow(clippy::too_many_arguments)]
 pub fn eval_key_stream(
     party_id: u8,
-    aes_keys: &Vec<u128>,
+    aes_keys: &[u128],
     _stream_id: usize,
     stream_length: usize,
     x_pointer: usize,
@@ -83,7 +86,7 @@ pub fn eval_key_stream(
 ) {
     assert!((party_id == 0u8) || (party_id == 1u8));
 
-    let mut prg = MMO::from_vec(aes_keys);
+    let mut prg = Mmo::from_vec(aes_keys);
 
     // Read, eval, write line by line
 
diff --git a/src/utils.rs b/src/utils.rs
index 51afca6..0639e5a 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -3,7 +3,7 @@ use aesni::cipher::{BlockCipher, NewBlockCipher};
 use aesni::Aes128;
 use std::slice;
 
-use super::stream::PRG;
+use super::stream::Prg;
 use super::L;
 
 pub fn share_leaf(mask_a: u32, mask_b: u32, share_bit: u8, flip_bit: u8) -> u32 {
@@ -34,6 +34,7 @@ pub fn bit_decomposition_u32(alpha: u32) -> Vec<u8> {
     alpha_bits
 }
 
+/// # Safety De-referencing raw pointer
 pub unsafe fn write_aes_key_to_raw_line(aes_key: u128, key_line_pointer: *mut u8) {
     // Cast the output line to a raw pointer.
     let out_ptr: *mut [u8; 16] =
@@ -44,6 +45,7 @@ pub unsafe fn write_aes_key_to_raw_line(aes_key: u128, key_line_pointer: *mut u8
     out_ref.copy_from_slice(&aes_key.to_le_bytes());
 }
 
+/// # Safety De-referencing raw pointer
 pub unsafe fn read_aes_key_from_raw_line(key_line_pointer: *const u8) -> u128 {
     let key_ptr: *const [u8; 16] =
         slice::from_raw_parts(key_line_pointer, 16).as_ptr() as *const [u8; 16];
@@ -51,34 +53,34 @@ pub unsafe fn read_aes_key_from_raw_line(key_line_pointer: *const u8) -> u128 {
     key
 }
 
-pub struct MMO {
+pub struct Mmo {
     // pub expansion_factor: usize,
     pub ciphers: Vec<Aes128>,
 }
 
 // TODO: hardcode the default keys
-impl PRG for MMO {
-    fn from_slice(aes_keys: &[u128]) -> MMO {
+impl Prg for Mmo {
+    fn from_slice(aes_keys: &[u128]) -> Mmo {
         let mut ciphers = vec![];
         for key in aes_keys {
             ciphers.push(aesni::Aes128::new(GenericArray::from_slice(
                 &key.to_le_bytes(),
             )));
         }
-        MMO {
+        Mmo {
             // expansion_factor: ciphers.len(),
             ciphers,
         }
     }
 
-    fn from_vec(aes_keys: &Vec<u128>) -> MMO {
+    fn from_vec(aes_keys: &[u128]) -> Mmo {
         let mut ciphers = vec![];
         for key in aes_keys {
             ciphers.push(aesni::Aes128::new(GenericArray::from_slice(
                 &key.to_le_bytes(),
             )));
         }
-        MMO {
+        Mmo {
             // expansion_factor: ciphers.len(),
             ciphers,
         }


Test patch:
diff --git a/tests/fss/test_dif.rs b/tests/fss/test_dif.rs
index 5c14bfa..04c90b7 100644
--- a/tests/fss/test_dif.rs
+++ b/tests/fss/test_dif.rs
@@ -2,8 +2,8 @@ use rand::Rng;
 
 extern crate sycret;
 use sycret::fss::dif::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 
 #[test]
 fn generate_and_evaluate_alpha() {
@@ -12,7 +12,7 @@ fn generate_and_evaluate_alpha() {
     for _ in 0..16 {
         let alpha: u32 = rng.gen();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = DIFKeyAlpha1::generate_keypair(&mut prg, alpha);
 
         // Evaluate separately on the same input.
@@ -31,7 +31,7 @@ fn generate_and_evaluate_le_alpha() {
     for _ in 0..16 {
         let alpha: u32 = rng.gen();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = DIFKeyAlpha1::generate_keypair(&mut prg, alpha);
 
         let not_alpha: u32 = alpha.wrapping_sub(rng.gen::<u32>());
@@ -53,7 +53,7 @@ fn generate_and_evaluate_strictly_greater_than_alpha() {
     for _ in 0..16 {
         let alpha: u32 = rng.gen();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = DIFKeyAlpha1::generate_keypair(&mut prg, alpha);
 
         let not_alpha: u32 = alpha.wrapping_add(rng.gen::<u32>());
diff --git a/tests/fss/test_dpf.rs b/tests/fss/test_dpf.rs
index a0f8a3c..679513b 100644
--- a/tests/fss/test_dpf.rs
+++ b/tests/fss/test_dpf.rs
@@ -2,8 +2,8 @@ use rand::Rng;
 
 extern crate sycret;
 use sycret::fss::dpf::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 
 #[test]
 fn generate_and_evaluate_alpha() {
@@ -12,7 +12,7 @@ fn generate_and_evaluate_alpha() {
     for _ in 0..16 {
         let alpha: u32 = rng.gen();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = DPFKeyAlpha1::generate_keypair(&mut prg, alpha);
 
         // Evaluate separately on the same input.
@@ -31,7 +31,7 @@ fn generate_and_evaluate_not_alpha() {
     for _ in 0..16 {
         let alpha: u32 = rng.gen();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = DPFKeyAlpha1::generate_keypair(&mut prg, alpha);
 
         let not_alpha: u32 = alpha.wrapping_add(rng.gen::<u32>());
diff --git a/tests/test_eq.rs b/tests/test_eq.rs
index fb5adeb..e925e06 100644
--- a/tests/test_eq.rs
+++ b/tests/test_eq.rs
@@ -2,8 +2,8 @@ use rand::Rng;
 
 extern crate sycret;
 use sycret::eq::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 
 #[test]
 fn generate_and_evaluate_alpha() {
@@ -11,7 +11,7 @@ fn generate_and_evaluate_alpha() {
     for _ in 0..16 {
         let mut rng = rand::thread_rng();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = EqKey::generate_keypair(&mut prg);
 
         // Recover alpha from the shares.
@@ -33,7 +33,7 @@ fn generate_and_evaluate_not_alpha() {
     for _ in 0..16 {
         let mut rng = rand::thread_rng();
         let aes_keys: [u128; 4] = rng.gen();
-        let mut prg = MMO::from_slice(&aes_keys);
+        let mut prg = Mmo::from_slice(&aes_keys);
         let (k_a, k_b) = EqKey::generate_keypair(&mut prg);
 
         // Recover alpha from the shares.
@@ -42,7 +42,7 @@ fn generate_and_evaluate_not_alpha() {
         println!("alpha: {:?}, masked: {:?}", alpha, k_a.alpha_share);
 
         // Modify alpha: we should leave the special path.
-        alpha = alpha + 1;
+        alpha += 1;
         println!("alpha flipped: {}", alpha);
 
         // Evaluate separately on the same input.
diff --git a/tests/test_le.rs b/tests/test_le.rs
index f96019e..7f68413 100644
--- a/tests/test_le.rs
+++ b/tests/test_le.rs
@@ -2,13 +2,13 @@ use rand::Rng;
 
 extern crate sycret;
 use sycret::le::*;
-use sycret::stream::{FSSKey, PRG};
-use sycret::utils::MMO;
+use sycret::stream::{FSSKey, Prg};
+use sycret::utils::Mmo;
 
 fn eval_on_alpha_with_offset(offset: i32) -> (u32, u32) {
     let mut rng = rand::thread_rng();
     let aes_keys: [u128; 4] = rng.gen();
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
 
     let (k_a, k_b) = LeKey::generate_keypair(&mut prg);
 
@@ -17,18 +17,18 @@ fn eval_on_alpha_with_offset(offset: i32) -> (u32, u32) {
 
     // Add some offset
     if offset > 0 {
-        alpha = alpha + offset as u32;
+        alpha += offset as u32;
     } else {
-        alpha = alpha - (-offset as u32);
+        alpha -= -offset as u32;
     }
 
     // Clean ciphers
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
 
     // Evaluate separately on alpha
     let a_output = k_a.eval(&mut prg, 0, alpha);
 
-    let mut prg = MMO::from_slice(&aes_keys);
+    let mut prg = Mmo::from_slice(&aes_keys);
     let b_output = k_b.eval(&mut prg, 1, alpha);
 
     (a_output, b_output)