mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-09 03:17:55 +00:00
Fix clippy lints
This commit is contained in:
@@ -175,11 +175,7 @@ impl<T: BeaconStateTypes> OperationPool<T> {
|
||||
|
||||
/// Total number of attestations in the pool, including attestations for the same data.
|
||||
pub fn num_attestations(&self) -> usize {
|
||||
self.attestations
|
||||
.read()
|
||||
.values()
|
||||
.map(|atts| atts.len())
|
||||
.sum()
|
||||
self.attestations.read().values().map(Vec::len).sum()
|
||||
}
|
||||
|
||||
/// Get a list of attestations for inclusion in a block.
|
||||
|
||||
@@ -817,7 +817,7 @@ impl<T: BeaconStateTypes> BeaconState<T> {
|
||||
self.tree_hash_cache
|
||||
.tree_hash_root()
|
||||
.and_then(|b| Ok(Hash256::from_slice(b)))
|
||||
.map_err(|e| e.into())
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ impl Decodable for BooleanBitfield {
|
||||
// as the BitVec library and the hex-parser use opposing bit orders.
|
||||
fn reverse_bit_order(mut bytes: Vec<u8>) -> Vec<u8> {
|
||||
bytes.reverse();
|
||||
bytes.into_iter().map(|b| b.swap_bits()).collect()
|
||||
bytes.into_iter().map(LookupReverse::swap_bits).collect()
|
||||
}
|
||||
|
||||
impl Serialize for BooleanBitfield {
|
||||
|
||||
@@ -22,6 +22,10 @@ impl<T, N: Unsigned> FixedLenVec<T, N> {
|
||||
self.vec.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
pub fn capacity() -> usize {
|
||||
N::to_usize()
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ pub fn merkle_root(values: &[Vec<u8>]) -> Option<Vec<u8>> {
|
||||
}
|
||||
|
||||
// the root hash will be at index 1
|
||||
return Some(o[1].clone());
|
||||
Some(o[1].clone())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user