Skip to content

Commit 76b8ace

Browse files
committed
fix(stm): clippy warnings
1 parent c0470dc commit 76b8ace

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

mithril-stm/src/aggregate_signature/signature.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl AggregateSignatureType {
2525
/// The prefix byte used in the byte representation of the aggregate signature type.
2626
///
2727
/// IMPORTANT: This value is used in serialization/deserialization. Changing it will break compatibility.
28-
pub fn to_bytes_encoding_prefix(&self) -> u8 {
28+
pub fn get_byte_encoding_prefix(&self) -> u8 {
2929
match self {
3030
AggregateSignatureType::Concatenation => 0,
3131
#[cfg(feature = "future_proof_system")]
@@ -36,7 +36,7 @@ impl AggregateSignatureType {
3636
/// Create an aggregate signature type from a prefix byte.
3737
///
3838
/// IMPORTANT: This value is used in serialization/deserialization. Changing it will break compatibility.
39-
pub fn from_bytes_encoding_prefix(byte: u8) -> Option<Self> {
39+
pub fn from_byte_encoding_prefix(byte: u8) -> Option<Self> {
4040
match byte {
4141
0 => Some(AggregateSignatureType::Concatenation),
4242
#[cfg(feature = "future_proof_system")]
@@ -155,7 +155,7 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
155155
let mut aggregate_signature_bytes = Vec::new();
156156
let aggregate_signature_type: AggregateSignatureType = self.into();
157157
aggregate_signature_bytes
158-
.extend_from_slice(&[aggregate_signature_type.to_bytes_encoding_prefix()]);
158+
.extend_from_slice(&[aggregate_signature_type.get_byte_encoding_prefix()]);
159159

160160
let mut proof_bytes = match self {
161161
AggregateSignature::Concatenation(concatenation_proof) => {
@@ -171,9 +171,10 @@ impl<D: Clone + Digest + FixedOutput + Send + Sync> AggregateSignature<D> {
171171

172172
/// Extract an aggregate signature from a byte slice.
173173
pub fn from_bytes(bytes: &[u8]) -> Result<Self, StmAggregateSignatureError<D>> {
174-
let proof_type_byte = bytes.get(0).ok_or(StmAggregateSignatureError::SerializationError)?;
174+
let proof_type_byte =
175+
bytes.first().ok_or(StmAggregateSignatureError::SerializationError)?;
175176
let proof_bytes = &bytes[1..];
176-
let proof_type = AggregateSignatureType::from_bytes_encoding_prefix(*proof_type_byte)
177+
let proof_type = AggregateSignatureType::from_byte_encoding_prefix(*proof_type_byte)
177178
.ok_or(StmAggregateSignatureError::SerializationError)?;
178179
match proof_type {
179180
AggregateSignatureType::Concatenation => Ok(AggregateSignature::Concatenation(
@@ -248,10 +249,10 @@ mod tests {
248249
fn golden_bytes_encoding_prefix() {
249250
assert_eq!(
250251
0u8,
251-
AggregateSignatureType::Concatenation.to_bytes_encoding_prefix()
252+
AggregateSignatureType::Concatenation.get_byte_encoding_prefix()
252253
);
253254
assert_eq!(
254-
AggregateSignatureType::from_bytes_encoding_prefix(0u8),
255+
AggregateSignatureType::from_byte_encoding_prefix(0u8),
255256
Some(AggregateSignatureType::Concatenation)
256257
);
257258
}

0 commit comments

Comments
 (0)