Fixing clippy warnings

This commit is contained in:
Tomasz Drwięga 2016-04-12 13:54:34 +02:00
parent 6b03a3218c
commit 7fbe3f4721
5 changed files with 13 additions and 16 deletions

View File

@ -140,11 +140,9 @@ impl<'a> Executive<'a> {
let init_gas = t.gas - base_gas_required; let init_gas = t.gas - base_gas_required;
// validate transaction nonce // validate transaction nonce
if check_nonce { if check_nonce && t.nonce != nonce {
if t.nonce != nonce {
return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce })); return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce }));
} }
}
// validate if transaction fits into given block // validate if transaction fits into given block
if self.info.gas_used + t.gas > self.info.gas_limit { if self.info.gas_used + t.gas > self.info.gas_limit {

View File

@ -67,6 +67,8 @@ pub struct Externalities<'a, T> where T: 'a + Tracer {
} }
impl<'a, T> Externalities<'a, T> where T: 'a + Tracer { impl<'a, T> Externalities<'a, T> where T: 'a + Tracer {
#[cfg_attr(feature="dev", allow(too_many_arguments))]
/// Basic `Externalities` constructor. /// Basic `Externalities` constructor.
pub fn new(state: &'a mut State, pub fn new(state: &'a mut State,
env_info: &'a EnvInfo, env_info: &'a EnvInfo,

View File

@ -19,7 +19,7 @@ use common::*;
/// State changes which should be applied in finalize, /// State changes which should be applied in finalize,
/// after transaction is fully executed. /// after transaction is fully executed.
#[derive(Debug)] #[derive(Debug, Default)]
pub struct Substate { pub struct Substate {
/// Any accounts that have suicided. /// Any accounts that have suicided.
pub suicides: HashSet<Address>, pub suicides: HashSet<Address>,

View File

@ -17,7 +17,7 @@
//! Tracing datatypes. //! Tracing datatypes.
use common::*; use common::*;
/// TraceCall result. /// `TraceCall` result.
#[derive(Debug, Clone, PartialEq, Default)] #[derive(Debug, Clone, PartialEq, Default)]
pub struct TraceCallResult { pub struct TraceCallResult {
/// Gas used by call. /// Gas used by call.
@ -26,7 +26,7 @@ pub struct TraceCallResult {
pub output: Bytes, pub output: Bytes,
} }
/// TraceCreate result. /// `TraceCreate` result.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct TraceCreateResult { pub struct TraceCreateResult {
/// Gas used by create. /// Gas used by create.

View File

@ -22,6 +22,7 @@ use std::fs::File;
use std::env; use std::env;
use std::io::{Read, Write}; use std::io::{Read, Write};
#[cfg_attr(feature="dev", allow(enum_variant_names))]
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
CannotLockVersionFile, CannotLockVersionFile,
@ -107,16 +108,12 @@ fn with_locked_version<F>(script: F) -> Result<usize, Error>
}) })
.unwrap_or_else(|| Version::parse("0.9.0").unwrap()); .unwrap_or_else(|| Version::parse("0.9.0").unwrap());
let script_result = {
let mut lock = try!(File::create(&path).map_err(|_| Error::CannotLockVersionFile)); let mut lock = try!(File::create(&path).map_err(|_| Error::CannotLockVersionFile));
let result = script(&version); let result = script(&version);
let written_version = Version::parse(CURRENT_VERSION).unwrap(); let written_version = Version::parse(CURRENT_VERSION).unwrap();
try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile)); try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile));
result result
};
script_result
} }
pub fn upgrade() -> Result<usize, Error> { pub fn upgrade() -> Result<usize, Error> {