Fixing clippy warnings

This commit is contained in:
Tomasz Drwięga
2016-03-11 10:57:58 +01:00
parent 3a4a7ac822
commit 8709dd28f8
17 changed files with 131 additions and 39 deletions

View File

@@ -35,13 +35,13 @@ pub enum ExtrasIndex {
BlocksBlooms = 4,
/// Block receipts index
BlockReceipts = 5,
}
}
/// trait used to write Extras data to db
pub trait ExtrasWritable {
/// Write extra data to db
fn put_extras<K, T>(&self, hash: &K, value: &T) where
T: ExtrasIndexable + Encodable,
T: ExtrasIndexable + Encodable,
K: ExtrasSliceConvertable;
}
@@ -60,9 +60,9 @@ pub trait ExtrasReadable {
impl ExtrasWritable for DBTransaction {
fn put_extras<K, T>(&self, hash: &K, value: &T) where
T: ExtrasIndexable + Encodable,
T: ExtrasIndexable + Encodable,
K: ExtrasSliceConvertable {
self.put(&hash.to_extras_slice(T::extras_index()), &encode(value)).unwrap()
}
}
@@ -215,6 +215,12 @@ pub struct BlocksBlooms {
pub blooms: [H2048; 16],
}
impl Default for BlocksBlooms {
fn default() -> Self {
BlocksBlooms::new()
}
}
impl BlocksBlooms {
pub fn new() -> Self {
BlocksBlooms { blooms: unsafe { ::std::mem::zeroed() }}

View File

@@ -25,6 +25,8 @@
#![cfg_attr(all(nightly, feature="dev"), allow(match_bool))]
// Keeps consistency (all lines with `.clone()`) and helpful when changing ref to non-ref.
#![cfg_attr(all(nightly, feature="dev"), allow(clone_on_copy))]
// In most cases it expresses function flow better
#![cfg_attr(all(nightly, feature="dev"), allow(if_not_else))]
//! Ethcore library
//!

View File

@@ -31,6 +31,12 @@ pub struct Substate {
pub contracts_created: Vec<Address>
}
impl Default for Substate {
fn default() -> Self {
Substate::new()
}
}
impl Substate {
/// Creates new substate.
pub fn new() -> Self {
@@ -67,8 +73,8 @@ mod tests {
let mut sub_state = Substate::new();
sub_state.contracts_created.push(address_from_u64(1u64));
sub_state.logs.push(LogEntry {
address: address_from_u64(1u64),
topics: vec![],
address: address_from_u64(1u64),
topics: vec![],
data: vec![]
});
sub_state.sstore_clears_count = x!(5);
@@ -77,8 +83,8 @@ mod tests {
let mut sub_state_2 = Substate::new();
sub_state_2.contracts_created.push(address_from_u64(2u64));
sub_state_2.logs.push(LogEntry {
address: address_from_u64(1u64),
topics: vec![],
address: address_from_u64(1u64),
topics: vec![],
data: vec![]
});
sub_state_2.sstore_clears_count = x!(7);