Skip to content

Commit 02533a0

Browse files
committed
Cleanup
1 parent c6c7d91 commit 02533a0

File tree

14 files changed

+42
-42
lines changed

14 files changed

+42
-42
lines changed

src/bls12_377/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 48] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 48];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/bls12_377/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 48] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 48];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/bls12_381/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 48] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 48];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/bls12_381/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 48] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 48];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/bn_254/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/bn_254/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/ed_on_bls12_377/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/ed_on_bls12_377/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/jubjub/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/jubjub/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/pallas/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/pallas/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/vesta/anemoi_2_1/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

src/vesta/anemoi_4_3/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ impl AnemoiDigest {
4040

4141
/// Returns an array of bytes corresponding to the digest
4242
pub fn to_bytes(&self) -> [u8; 32] {
43-
let mut bytes = Vec::new();
44-
self.0[0].serialize_compressed(&mut bytes).unwrap();
45-
bytes.try_into().unwrap()
43+
let mut bytes = [0u8; 32];
44+
self.0[0].serialize_compressed(&mut bytes[..]).unwrap();
45+
bytes
4646
}
4747
}
4848

0 commit comments

Comments
 (0)