From b2495cbcff91e4e6879c7201883d06d249b59560 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 24 Oct 2018 15:40:09 +0200 Subject: [PATCH] Fix clippy lints --- beacon_chain/types/src/chain_config.rs | 6 +++--- beacon_chain/types/src/special_record.rs | 2 +- beacon_chain/utils/ssz_helpers/src/ssz_beacon_block.rs | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/beacon_chain/types/src/chain_config.rs b/beacon_chain/types/src/chain_config.rs index 49128b49f7..7437bed478 100644 --- a/beacon_chain/types/src/chain_config.rs +++ b/beacon_chain/types/src/chain_config.rs @@ -21,7 +21,7 @@ impl ChainConfig { pub fn standard() -> Self { Self { cycle_length: 64, - deposit_size_gwei: 32 * 10^9, + deposit_size_gwei: 32 * (10^9), shard_count: 1024, min_committee_size: 128, max_validator_churn_quotient: 32, @@ -36,7 +36,7 @@ impl ChainConfig { // shard_count / cycle_length > 0 otherwise validator delegation // will fail. - if self.shard_count / self.cycle_length as u16 == 0 { + if self.shard_count / u16::from(self.cycle_length) == 0 { return false; } @@ -49,7 +49,7 @@ impl ChainConfig { pub fn super_fast_tests() -> Self { Self { cycle_length: 2, - deposit_size_gwei: 32 * 10^9, + deposit_size_gwei: 32 * (10^9), shard_count: 2, min_committee_size: 2, max_validator_churn_quotient: 32, diff --git a/beacon_chain/types/src/special_record.rs b/beacon_chain/types/src/special_record.rs index 9189728dfa..186e449b19 100644 --- a/beacon_chain/types/src/special_record.rs +++ b/beacon_chain/types/src/special_record.rs @@ -49,7 +49,7 @@ impl SpecialRecord { /// Match `self.kind` to a `SpecialRecordKind`. /// /// Returns `None` if `self.kind` is an unknown value. - fn resolve_kind(&self) -> Option { + pub fn resolve_kind(&self) -> Option { match self.kind { x if x == SpecialRecordKind::Logout as u8 => Some(SpecialRecordKind::Logout), diff --git a/beacon_chain/utils/ssz_helpers/src/ssz_beacon_block.rs b/beacon_chain/utils/ssz_helpers/src/ssz_beacon_block.rs index 3066f5679b..d466d3abc6 100644 --- a/beacon_chain/utils/ssz_helpers/src/ssz_beacon_block.rs +++ b/beacon_chain/utils/ssz_helpers/src/ssz_beacon_block.rs @@ -127,6 +127,7 @@ impl<'a> SszBeaconBlock<'a> { } pub fn len(&self) -> usize { self.ssz.len() } + pub fn is_empty(&self) -> bool { self.ssz.is_empty() } /// Return the canonical hash for this block. pub fn block_hash(&self) -> Vec {