Fixing clippy warnings (#1660)

This commit is contained in:
Tomasz Drwięga
2016-07-19 09:25:51 +02:00
committed by Gav Wood
parent 340f0b6f58
commit 038862fa9d
9 changed files with 31 additions and 26 deletions

View File

@@ -390,7 +390,8 @@ impl BlockChain {
return Some(hash);
}
}
return None;
None
}
/// Set the cache configuration.

View File

@@ -43,7 +43,7 @@ pub struct EthashParams {
pub dao_hardfork_transition: u64,
/// DAO hard-fork refund contract address (C).
pub dao_hardfork_beneficiary: Address,
/// DAO hard-fork DAO accounts list (L)
/// DAO hard-fork DAO accounts list (L)
pub dao_hardfork_accounts: Vec<Address>,
}
@@ -55,11 +55,11 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
difficulty_bound_divisor: p.difficulty_bound_divisor.into(),
duration_limit: p.duration_limit.into(),
block_reward: p.block_reward.into(),
registrar: p.registrar.map(Into::into).unwrap_or(Address::new()),
frontier_compatibility_mode_limit: p.frontier_compatibility_mode_limit.map(Into::into).unwrap_or(0),
dao_hardfork_transition: p.dao_hardfork_transition.map(Into::into).unwrap_or(0x7fffffffffffffff),
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map(Into::into).unwrap_or(Address::new()),
dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or(vec![]).into_iter().map(Into::into).collect(),
registrar: p.registrar.map_or_else(Address::new, Into::into),
frontier_compatibility_mode_limit: p.frontier_compatibility_mode_limit.map_or(0, Into::into),
dao_hardfork_transition: p.dao_hardfork_transition.map_or(0x7fffffffffffffff, Into::into),
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into),
dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(),
}
}
}
@@ -131,7 +131,7 @@ impl Engine for Ethash {
if header.number >= self.ethash_params.dao_hardfork_transition &&
header.number <= self.ethash_params.dao_hardfork_transition + 9 {
header.extra_data = b"dao-hard-fork"[..].to_owned();
}
}
header.note_dirty();
// info!("ethash: populate_from_parent #{}: difficulty={} and gas_limit={}", header.number, header.difficulty, header.gas_limit);
}
@@ -141,7 +141,7 @@ impl Engine for Ethash {
// TODO: enable trigger function maybe?
// if block.fields().header.gas_limit <= 4_000_000.into() {
let mut state = block.fields_mut().state;
for child in self.ethash_params.dao_hardfork_accounts.iter() {
for child in &self.ethash_params.dao_hardfork_accounts {
let b = state.balance(child);
state.transfer_balance(child, &self.ethash_params.dao_hardfork_beneficiary, &b);
}
@@ -199,8 +199,8 @@ impl Engine for Ethash {
if header.gas_limit > 0x7fffffffffffffffu64.into() {
return Err(From::from(BlockError::InvalidGasLimit(OutOfBounds { min: None, max: Some(0x7fffffffffffffffu64.into()), found: header.gas_limit })));
}
}
Ok(())
}

View File

@@ -61,7 +61,7 @@ fn attempt_migrate(mut key_h: H256, val: &[u8]) -> Option<H256> {
}
}
/// Version for ArchiveDB.
/// Version for `ArchiveDB`.
#[derive(Default)]
pub struct ArchiveV7(usize);

View File

@@ -72,7 +72,7 @@ pub fn take_snapshot(client: &BlockChainClient, mut path: PathBuf, state_db: &Ha
let mut manifest_file = try!(File::create(&path));
try!(manifest_file.write_all(&manifest_data.to_rlp()));
try!(manifest_file.write_all(&manifest_data.into_rlp()));
Ok(())
}
@@ -287,7 +287,7 @@ pub struct ManifestData {
impl ManifestData {
/// Encode the manifest data to rlp.
pub fn to_rlp(self) -> Bytes {
pub fn into_rlp(self) -> Bytes {
let mut stream = RlpStream::new_list(5);
stream.append(&self.state_hashes);
stream.append(&self.block_hashes);
@@ -414,4 +414,4 @@ fn rebuild_account_trie(db: &mut HashDB, account_chunk: &[&[u8]], out_chunk: &mu
*out = (hash, thin_rlp);
}
Ok(())
}
}