Fix clippy

This commit is contained in:
Emilia Hane 2023-01-26 22:28:49 +01:00
parent 4d3ff347a3
commit 481718856c
No known key found for this signature in database
GPG Key ID: E73394F9C09206FA
2 changed files with 4 additions and 5 deletions

View File

@ -479,7 +479,7 @@ pub fn decode_list_of_variable_length_items<T: Decode, Container: TryFromIter<T>
) -> Result<Container, DecodeError> {
if bytes.is_empty() {
return Container::try_from_iter(iter::empty()).map_err(|e| {
DecodeError::BytesInvalid(format!("Error trying to collect empty list: {:?}", e))
DecodeError::BytesInvalid(format!("Error trying to collect empty list: {e:?}"))
});
}
@ -494,8 +494,7 @@ pub fn decode_list_of_variable_length_items<T: Decode, Container: TryFromIter<T>
if max_len.map_or(false, |max| num_items > max) {
return Err(DecodeError::BytesInvalid(format!(
"Variable length list of {} items exceeds maximum of {:?}",
num_items, max_len
"Variable length list of {num_items} items exceeds maximum of {max_len:?}",
)));
}
@ -519,7 +518,7 @@ pub fn decode_list_of_variable_length_items<T: Decode, Container: TryFromIter<T>
}),
|iter| iter.try_collect(),
)?
.map_err(|e| DecodeError::BytesInvalid(format!("Error collecting into container: {:?}", e)))
.map_err(|e| DecodeError::BytesInvalid(format!("Error collecting into container: {e:?}")))
}
#[cfg(test)]

View File

@ -97,7 +97,7 @@ fn get_zero_hash(height: usize) -> &'static [u8] {
if height <= ZERO_HASHES_MAX_INDEX {
&ZERO_HASHES[height]
} else {
panic!("Tree exceeds MAX_TREE_DEPTH of {}", ZERO_HASHES_MAX_INDEX)
panic!("Tree exceeds MAX_TREE_DEPTH of {ZERO_HASHES_MAX_INDEX}")
}
}