From 4ec036c851a107c7fcc55d8b4ae628a4a0070461 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 28 Apr 2022 20:58:31 +0000 Subject: [PATCH] Remove unnecessary usage of `Vec` --- src/constants/sinsemilla.rs | 17 ++++------------- src/spec.rs | 7 ++----- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/constants/sinsemilla.rs b/src/constants/sinsemilla.rs index 5ac70012..59831e38 100644 --- a/src/constants/sinsemilla.rs +++ b/src/constants/sinsemilla.rs @@ -161,27 +161,18 @@ mod tests { #[test] fn i2lebsp_k_round_trip() { { - let bitstring = (0..K).map(|_| rand::random()).collect::>(); - assert_eq!( - i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(), - bitstring - ); + let bitstring = [0; K].map(|_| rand::random()); + assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring); } { let bitstring = [false; K]; - assert_eq!( - i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(), - bitstring - ); + assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring); } { let bitstring = [true; K]; - assert_eq!( - i2lebsp_k(lebs2ip_k(&bitstring) as usize).to_vec(), - bitstring - ); + assert_eq!(i2lebsp_k(lebs2ip_k(&bitstring) as usize), bitstring); } } diff --git a/src/spec.rs b/src/spec.rs index fcc929d9..8670b9e3 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -302,11 +302,8 @@ mod tests { #[test] fn i2lebsp_round_trip() { { - let bitstring = (0..64).map(|_| rand::random()).collect::>(); - assert_eq!( - i2lebsp::<64>(lebs2ip::<64>(&bitstring.clone().try_into().unwrap())).to_vec(), - bitstring - ); + let bitstring = [0; 64].map(|_| rand::random()); + assert_eq!(i2lebsp(lebs2ip(&bitstring)), bitstring); } {