Fix clippy
This commit is contained in:
parent
4d3ff347a3
commit
481718856c
@ -479,7 +479,7 @@ pub fn decode_list_of_variable_length_items<T: Decode, Container: TryFromIter<T>
|
|||||||
) -> Result<Container, DecodeError> {
|
) -> Result<Container, DecodeError> {
|
||||||
if bytes.is_empty() {
|
if bytes.is_empty() {
|
||||||
return Container::try_from_iter(iter::empty()).map_err(|e| {
|
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) {
|
if max_len.map_or(false, |max| num_items > max) {
|
||||||
return Err(DecodeError::BytesInvalid(format!(
|
return Err(DecodeError::BytesInvalid(format!(
|
||||||
"Variable length list of {} items exceeds maximum of {:?}",
|
"Variable length list of {num_items} items exceeds maximum of {max_len:?}",
|
||||||
num_items, max_len
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +518,7 @@ pub fn decode_list_of_variable_length_items<T: Decode, Container: TryFromIter<T>
|
|||||||
}),
|
}),
|
||||||
|iter| iter.try_collect(),
|
|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)]
|
#[cfg(test)]
|
||||||
|
@ -97,7 +97,7 @@ fn get_zero_hash(height: usize) -> &'static [u8] {
|
|||||||
if height <= ZERO_HASHES_MAX_INDEX {
|
if height <= ZERO_HASHES_MAX_INDEX {
|
||||||
&ZERO_HASHES[height]
|
&ZERO_HASHES[height]
|
||||||
} else {
|
} else {
|
||||||
panic!("Tree exceeds MAX_TREE_DEPTH of {}", ZERO_HASHES_MAX_INDEX)
|
panic!("Tree exceeds MAX_TREE_DEPTH of {ZERO_HASHES_MAX_INDEX}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user