From e714ec0489dfcd8e99ab6e275761f5f9b2b082ad Mon Sep 17 00:00:00 2001 From: Grant Wuerker Date: Sat, 20 Oct 2018 17:04:17 -0500 Subject: [PATCH] cast_lossless warning supressed and better looking vectors --- beacon_chain/utils/ssz/src/encode.rs | 6 +++--- beacon_chain/utils/ssz/src/impl_encode.rs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/beacon_chain/utils/ssz/src/encode.rs b/beacon_chain/utils/ssz/src/encode.rs index 5080924cc..b501ebe40 100644 --- a/beacon_chain/utils/ssz/src/encode.rs +++ b/beacon_chain/utils/ssz/src/encode.rs @@ -41,7 +41,7 @@ impl SszStream { /// /// The length of the supplied bytes will be concatenated /// to the stream before the supplied bytes. - pub fn append_encoded_val(&mut self, vec: &Vec) { + pub fn append_encoded_val(&mut self, vec: &[u8]) { self.buffer.extend_from_slice( &encode_length(vec.len(), LENGTH_BYTES)); @@ -51,7 +51,7 @@ impl SszStream { /// Append some ssz encoded bytes to the stream without calculating length /// /// The raw bytes will be concatenated to the stream. - pub fn append_encoded_raw(&mut self, vec: &Vec) { + pub fn append_encoded_raw(&mut self, vec: &[u8]) { self.buffer.extend_from_slice(&vec); } @@ -59,7 +59,7 @@ impl SszStream { /// /// The length of the list will be concatenated to the stream, then /// each item in the vector will be encoded and concatenated. - pub fn append_vec(&mut self, vec: &Vec) + pub fn append_vec(&mut self, vec: &[E]) where E: Encodable { let mut list_stream = SszStream::new(); diff --git a/beacon_chain/utils/ssz/src/impl_encode.rs b/beacon_chain/utils/ssz/src/impl_encode.rs index 36776e071..a2e955d37 100644 --- a/beacon_chain/utils/ssz/src/impl_encode.rs +++ b/beacon_chain/utils/ssz/src/impl_encode.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "clippy"), allow(cast_lossless))] + extern crate bytes; use super::{