mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Fix clippy warnings (#813)
* Clippy account manager * Clippy account_manager * Clippy beacon_node/beacon_chain * Clippy beacon_node/client * Clippy beacon_node/eth1 * Clippy beacon_node/eth2-libp2p * Clippy beacon_node/genesis * Clippy beacon_node/network * Clippy beacon_node/rest_api * Clippy beacon_node/src * Clippy beacon_node/store * Clippy eth2/lmd_ghost * Clippy eth2/operation_pool * Clippy eth2/state_processing * Clippy eth2/types * Clippy eth2/utils/bls * Clippy eth2/utils/cahced_tree_hash * Clippy eth2/utils/deposit_contract * Clippy eth2/utils/eth2_interop_keypairs * Clippy eth2/utils/eth2_testnet_config * Clippy eth2/utils/lighthouse_metrics * Clippy eth2/utils/ssz * Clippy eth2/utils/ssz_types * Clippy eth2/utils/tree_hash_derive * Clippy lcli * Clippy tests/beacon_chain_sim * Clippy validator_client * Cargo fmt
This commit is contained in:
@@ -99,7 +99,7 @@ impl<'a> SszDecoderBuilder<'a> {
|
||||
let previous_offset = self
|
||||
.offsets
|
||||
.last()
|
||||
.and_then(|o| Some(o.offset))
|
||||
.map(|o| o.offset)
|
||||
.unwrap_or_else(|| BYTES_PER_LENGTH_OFFSET);
|
||||
|
||||
if (previous_offset > offset) || (offset > self.bytes.len()) {
|
||||
@@ -179,7 +179,7 @@ impl<'a> SszDecoderBuilder<'a> {
|
||||
/// b: Vec<u16>,
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
/// fn ssz_decoding_example() {
|
||||
/// let foo = Foo {
|
||||
/// a: 42,
|
||||
/// b: vec![1, 3, 3, 7]
|
||||
|
||||
@@ -207,9 +207,10 @@ impl Decode for bool {
|
||||
match bytes[0] {
|
||||
0b0000_0000 => Ok(false),
|
||||
0b0000_0001 => Ok(true),
|
||||
_ => Err(DecodeError::BytesInvalid(
|
||||
format!("Out-of-range for boolean: {}", bytes[0]).to_string(),
|
||||
)),
|
||||
_ => Err(DecodeError::BytesInvalid(format!(
|
||||
"Out-of-range for boolean: {}",
|
||||
bytes[0]
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ pub trait Encode {
|
||||
/// b: Vec<u16>,
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
/// fn ssz_encode_example() {
|
||||
/// let foo = Foo {
|
||||
/// a: 42,
|
||||
/// b: vec![1, 3, 3, 7]
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! b: Vec<u16>,
|
||||
//! }
|
||||
//!
|
||||
//! fn main() {
|
||||
//! fn ssz_encode_decode_example() {
|
||||
//! let foo = Foo {
|
||||
//! a: 42,
|
||||
//! b: vec![1, 3, 3, 7]
|
||||
|
||||
Reference in New Issue
Block a user