From 7fbe3f4721e75a84b25fcf41ca815a698115037c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 12 Apr 2016 13:54:34 +0200 Subject: [PATCH] Fixing clippy warnings --- ethcore/src/executive.rs | 6 ++---- ethcore/src/externalities.rs | 2 ++ ethcore/src/substate.rs | 2 +- ethcore/src/trace/trace.rs | 4 ++-- parity/upgrade.rs | 15 ++++++--------- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index fc2f837ef..bd30e0fb6 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -140,10 +140,8 @@ impl<'a> Executive<'a> { let init_gas = t.gas - base_gas_required; // validate transaction nonce - if check_nonce { - if t.nonce != nonce { - return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce })); - } + if check_nonce && t.nonce != nonce { + return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce })); } // validate if transaction fits into given block diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index e5e232a98..1c0bb417f 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -67,6 +67,8 @@ pub struct 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. pub fn new(state: &'a mut State, env_info: &'a EnvInfo, diff --git a/ethcore/src/substate.rs b/ethcore/src/substate.rs index f643fea07..65b314663 100644 --- a/ethcore/src/substate.rs +++ b/ethcore/src/substate.rs @@ -19,7 +19,7 @@ use common::*; /// State changes which should be applied in finalize, /// after transaction is fully executed. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Substate { /// Any accounts that have suicided. pub suicides: HashSet
, diff --git a/ethcore/src/trace/trace.rs b/ethcore/src/trace/trace.rs index b0e2e75f5..6a90aaf8a 100644 --- a/ethcore/src/trace/trace.rs +++ b/ethcore/src/trace/trace.rs @@ -17,7 +17,7 @@ //! Tracing datatypes. use common::*; -/// TraceCall result. +/// `TraceCall` result. #[derive(Debug, Clone, PartialEq, Default)] pub struct TraceCallResult { /// Gas used by call. @@ -26,7 +26,7 @@ pub struct TraceCallResult { pub output: Bytes, } -/// TraceCreate result. +/// `TraceCreate` result. #[derive(Debug, Clone, PartialEq)] pub struct TraceCreateResult { /// Gas used by create. diff --git a/parity/upgrade.rs b/parity/upgrade.rs index c9c98e174..da01c039e 100644 --- a/parity/upgrade.rs +++ b/parity/upgrade.rs @@ -22,6 +22,7 @@ use std::fs::File; use std::env; use std::io::{Read, Write}; +#[cfg_attr(feature="dev", allow(enum_variant_names))] #[derive(Debug)] pub enum Error { CannotLockVersionFile, @@ -107,16 +108,12 @@ fn with_locked_version(script: F) -> Result }) .unwrap_or_else(|| Version::parse("0.9.0").unwrap()); - let script_result = { - let mut lock = try!(File::create(&path).map_err(|_| Error::CannotLockVersionFile)); - let result = script(&version); + let mut lock = try!(File::create(&path).map_err(|_| Error::CannotLockVersionFile)); + let result = script(&version); - let written_version = Version::parse(CURRENT_VERSION).unwrap(); - try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile)); - result - }; - - script_result + let written_version = Version::parse(CURRENT_VERSION).unwrap(); + try!(lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile)); + result } pub fn upgrade() -> Result {