Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
remove trait bounds from several structs (#9055)
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored and andresilva committed Jul 9, 2018
1 parent 701692b commit c7d2184
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ethcore/src/cache_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::hash::Hash;

const COLLECTION_QUEUE_SIZE: usize = 8;

pub struct CacheManager<T> where T: Eq + Hash {
pub struct CacheManager<T> {
pref_cache_size: usize,
max_cache_size: usize,
bytes_per_cache_entry: usize,
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl TransactOptions<trace::NoopTracer, trace::NoopVMTracer> {
}

/// Transaction executor.
pub struct Executive<'a, B: 'a + StateBackend> {
pub struct Executive<'a, B: 'a> {
state: &'a mut State<B>,
info: &'a EnvInfo,
machine: &'a Machine,
Expand Down
4 changes: 1 addition & 3 deletions ethcore/src/externalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B>,
env_info: &'a EnvInfo,
machine: &'a Machine,
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pub fn prove_transaction<H: AsHashDB<KeccakHasher> + 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<B: Backend> {
pub struct State<B> {
db: B,
root: H256,
cache: RefCell<HashMap<Address, AccountEntry>>,
Expand Down
12 changes: 9 additions & 3 deletions ethcore/types/src/account_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use bytes::Bytes;

#[derive(Debug, PartialEq, Eq, Clone)]
/// Diff type for specifying a change (or not).
pub enum Diff<T> where T: Eq {
pub enum Diff<T> {
/// Both sides are the same.
Same,
/// Left (pre, source) side doesn't include value, right side (post, destination) does.
Expand All @@ -35,9 +35,15 @@ pub enum Diff<T> where T: Eq {
Died(T),
}

impl<T> Diff<T> where T: Eq {
impl<T> Diff<T> {
/// 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 } }
Expand Down

0 comments on commit c7d2184

Please sign in to comment.