From c7d21841a427b74c880d2d45010df51a764da8dd Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 9 Jul 2018 13:55:27 +0200 Subject: [PATCH] remove trait bounds from several structs (#9055) --- ethcore/src/cache_manager.rs | 2 +- ethcore/src/executive.rs | 2 +- ethcore/src/externalities.rs | 4 +--- ethcore/src/state/mod.rs | 2 +- ethcore/types/src/account_diff.rs | 12 +++++++++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ethcore/src/cache_manager.rs b/ethcore/src/cache_manager.rs index 4199cb1d593..07a9750a0ee 100644 --- a/ethcore/src/cache_manager.rs +++ b/ethcore/src/cache_manager.rs @@ -19,7 +19,7 @@ use std::hash::Hash; const COLLECTION_QUEUE_SIZE: usize = 8; -pub struct CacheManager where T: Eq + Hash { +pub struct CacheManager { pref_cache_size: usize, max_cache_size: usize, bytes_per_cache_entry: usize, diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index f375f3c2e88..37dc03dee28 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -163,7 +163,7 @@ impl TransactOptions { } /// Transaction executor. -pub struct Executive<'a, B: 'a + StateBackend> { +pub struct Executive<'a, B: 'a> { state: &'a mut State, info: &'a EnvInfo, machine: &'a Machine, diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 65d130c3422..d315122d56a 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -63,9 +63,7 @@ impl OriginInfo { } /// Implementation of evm Externalities. -pub struct Externalities<'a, T: 'a, V: 'a, B: 'a> - where T: Tracer, V: VMTracer, B: StateBackend -{ +pub struct Externalities<'a, T: 'a, V: 'a, B: 'a> { state: &'a mut State, env_info: &'a EnvInfo, machine: &'a Machine, diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index f785e24a335..0da61425442 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -305,7 +305,7 @@ pub fn prove_transaction + Send + Sync>( /// checkpoint can be discarded with `discard_checkpoint`. All of the orignal /// backed-up values are moved into a parent checkpoint (if any). /// -pub struct State { +pub struct State { db: B, root: H256, cache: RefCell>, diff --git a/ethcore/types/src/account_diff.rs b/ethcore/types/src/account_diff.rs index 521ed8ab1f8..9633ffeb078 100644 --- a/ethcore/types/src/account_diff.rs +++ b/ethcore/types/src/account_diff.rs @@ -24,7 +24,7 @@ use bytes::Bytes; #[derive(Debug, PartialEq, Eq, Clone)] /// Diff type for specifying a change (or not). -pub enum Diff where T: Eq { +pub enum Diff { /// Both sides are the same. Same, /// Left (pre, source) side doesn't include value, right side (post, destination) does. @@ -35,9 +35,15 @@ pub enum Diff where T: Eq { Died(T), } -impl Diff where T: Eq { +impl Diff { /// Construct new object with given `pre` and `post`. - pub fn new(pre: T, post: T) -> Self { if pre == post { Diff::Same } else { Diff::Changed(pre, post) } } + pub fn new(pre: T, post: T) -> Self where T: Eq { + if pre == post { + Diff::Same + } else { + Diff::Changed(pre, post) + } + } /// Get the before value, if there is one. pub fn pre(&self) -> Option<&T> { match *self { Diff::Died(ref x) | Diff::Changed(ref x, _) => Some(x), _ => None } }