cast_lossless warning supressed and better looking vectors

This commit is contained in:
Grant Wuerker 2018-10-20 17:04:17 -05:00
parent 9c1d34253a
commit e714ec0489
2 changed files with 5 additions and 3 deletions

View File

@ -41,7 +41,7 @@ impl SszStream {
/// ///
/// The length of the supplied bytes will be concatenated /// The length of the supplied bytes will be concatenated
/// to the stream before the supplied bytes. /// to the stream before the supplied bytes.
pub fn append_encoded_val(&mut self, vec: &Vec<u8>) { pub fn append_encoded_val(&mut self, vec: &[u8]) {
self.buffer.extend_from_slice( self.buffer.extend_from_slice(
&encode_length(vec.len(), &encode_length(vec.len(),
LENGTH_BYTES)); LENGTH_BYTES));
@ -51,7 +51,7 @@ impl SszStream {
/// Append some ssz encoded bytes to the stream without calculating length /// Append some ssz encoded bytes to the stream without calculating length
/// ///
/// The raw bytes will be concatenated to the stream. /// The raw bytes will be concatenated to the stream.
pub fn append_encoded_raw(&mut self, vec: &Vec<u8>) { pub fn append_encoded_raw(&mut self, vec: &[u8]) {
self.buffer.extend_from_slice(&vec); self.buffer.extend_from_slice(&vec);
} }
@ -59,7 +59,7 @@ impl SszStream {
/// ///
/// The length of the list will be concatenated to the stream, then /// The length of the list will be concatenated to the stream, then
/// each item in the vector will be encoded and concatenated. /// each item in the vector will be encoded and concatenated.
pub fn append_vec<E>(&mut self, vec: &Vec<E>) pub fn append_vec<E>(&mut self, vec: &[E])
where E: Encodable where E: Encodable
{ {
let mut list_stream = SszStream::new(); let mut list_stream = SszStream::new();

View File

@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "clippy"), allow(cast_lossless))]
extern crate bytes; extern crate bytes;
use super::{ use super::{