Run cargo fix on a few of the worst offenders (#10854)

* Run cargo fix on `vm`

* Run cargo fix on ethcore-db

* Run cargo fix on evm

* Run cargo fix on ethcore-light

* Run cargo fix on journaldb

* Run cargo fix on wasm

* Missing docs

* Run cargo fix on ethcore-sync
This commit is contained in:
David
2019-07-09 10:04:20 +02:00
committed by Seun LanLege
parent fdc7b0fdaa
commit f53c3e582c
46 changed files with 369 additions and 368 deletions

View File

@@ -47,8 +47,8 @@ pub trait ChainDataFetcher: Send + Sync + 'static {
fn epoch_transition(
&self,
_hash: H256,
_engine: Arc<Engine>,
_checker: Arc<StateDependentProof>
_engine: Arc<dyn Engine>,
_checker: Arc<dyn StateDependentProof>
) -> Self::Transition;
}
@@ -76,8 +76,8 @@ impl ChainDataFetcher for Unavailable {
fn epoch_transition(
&self,
_hash: H256,
_engine: Arc<Engine>,
_checker: Arc<StateDependentProof>
_engine: Arc<dyn Engine>,
_checker: Arc<dyn StateDependentProof>
) -> Self::Transition {
Err("fetching epoch transition proofs unavailable")
}

View File

@@ -213,7 +213,7 @@ pub struct HeaderChain {
#[ignore_malloc_size_of = "ignored for performance reason"]
live_epoch_proofs: RwLock<H256FastMap<EpochTransition>>,
#[ignore_malloc_size_of = "ignored for performance reason"]
db: Arc<KeyValueDB>,
db: Arc<dyn KeyValueDB>,
#[ignore_malloc_size_of = "ignored for performance reason"]
col: Option<u32>,
#[ignore_malloc_size_of = "ignored for performance reason"]
@@ -223,7 +223,7 @@ pub struct HeaderChain {
impl HeaderChain {
/// Create a new header chain given this genesis block and database to read from.
pub fn new(
db: Arc<KeyValueDB>,
db: Arc<dyn KeyValueDB>,
col: Option<u32>,
spec: &Spec,
cache: Arc<Mutex<Cache>>,
@@ -880,7 +880,7 @@ mod tests {
use std::time::Duration;
use parking_lot::Mutex;
fn make_db() -> Arc<KeyValueDB> {
fn make_db() -> Arc<dyn KeyValueDB> {
Arc::new(kvdb_memorydb::create(0))
}

View File

@@ -79,7 +79,7 @@ impl Default for Config {
/// Trait for interacting with the header chain abstractly.
pub trait LightChainClient: Send + Sync {
/// Adds a new `LightChainNotify` listener.
fn add_listener(&self, listener: Weak<LightChainNotify>);
fn add_listener(&self, listener: Weak<dyn LightChainNotify>);
/// Get chain info.
fn chain_info(&self) -> BlockChainInfo;
@@ -104,7 +104,7 @@ pub trait LightChainClient: Send + Sync {
fn score(&self, id: BlockId) -> Option<U256>;
/// Get an iterator over a block and its ancestry.
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<Iterator<Item=encoded::Header> + 'a>;
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<dyn Iterator<Item=encoded::Header> + 'a>;
/// Get the signing chain ID.
fn signing_chain_id(&self) -> Option<u64>;
@@ -114,7 +114,7 @@ pub trait LightChainClient: Send + Sync {
fn env_info(&self, id: BlockId) -> Option<EnvInfo>;
/// Get a handle to the consensus engine.
fn engine(&self) -> &Arc<Engine>;
fn engine(&self) -> &Arc<dyn Engine>;
/// Query whether a block is known.
fn is_known(&self, hash: &H256) -> bool;
@@ -159,23 +159,23 @@ impl<T: LightChainClient> AsLightClient for T {
/// Light client implementation.
pub struct Client<T> {
queue: HeaderQueue,
engine: Arc<Engine>,
engine: Arc<dyn Engine>,
chain: HeaderChain,
report: RwLock<ClientReport>,
import_lock: Mutex<()>,
db: Arc<KeyValueDB>,
listeners: RwLock<Vec<Weak<LightChainNotify>>>,
db: Arc<dyn KeyValueDB>,
listeners: RwLock<Vec<Weak<dyn LightChainNotify>>>,
fetcher: T,
verify_full: bool,
/// A closure to call when we want to restart the client
exit_handler: Mutex<Option<Box<Fn(String) + 'static + Send>>>,
exit_handler: Mutex<Option<Box<dyn Fn(String) + 'static + Send>>>,
}
impl<T: ChainDataFetcher> Client<T> {
/// Create a new `Client`.
pub fn new(
config: Config,
db: Arc<KeyValueDB>,
db: Arc<dyn KeyValueDB>,
chain_col: Option<u32>,
spec: &Spec,
fetcher: T,
@@ -208,7 +208,7 @@ impl<T: ChainDataFetcher> Client<T> {
}
/// Adds a new `LightChainNotify` listener.
pub fn add_listener(&self, listener: Weak<LightChainNotify>) {
pub fn add_listener(&self, listener: Weak<dyn LightChainNotify>) {
self.listeners.write().push(listener);
}
@@ -375,7 +375,7 @@ impl<T: ChainDataFetcher> Client<T> {
}
/// Get a handle to the verification engine.
pub fn engine(&self) -> &Arc<Engine> {
pub fn engine(&self) -> &Arc<dyn Engine> {
&self.engine
}
@@ -416,7 +416,7 @@ impl<T: ChainDataFetcher> Client<T> {
Arc::new(v)
}
fn notify<F: Fn(&LightChainNotify)>(&self, f: F) {
fn notify<F: Fn(&dyn LightChainNotify)>(&self, f: F) {
for listener in &*self.listeners.read() {
if let Some(listener) = listener.upgrade() {
f(&*listener)
@@ -536,7 +536,7 @@ impl<T: ChainDataFetcher> Client<T> {
impl<T: ChainDataFetcher> LightChainClient for Client<T> {
fn add_listener(&self, listener: Weak<LightChainNotify>) {
fn add_listener(&self, listener: Weak<dyn LightChainNotify>) {
Client::add_listener(self, listener)
}
@@ -566,7 +566,7 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
Client::score(self, id)
}
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<Iterator<Item=encoded::Header> + 'a> {
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<dyn Iterator<Item=encoded::Header> + 'a> {
Box::new(Client::ancestry_iter(self, start))
}
@@ -578,7 +578,7 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
Client::env_info(self, id)
}
fn engine(&self) -> &Arc<Engine> {
fn engine(&self) -> &Arc<dyn Engine> {
Client::engine(self)
}
@@ -633,7 +633,7 @@ impl<T: ChainDataFetcher> ::ethcore::client::EngineClient for Client<T> {
})
}
fn as_full_client(&self) -> Option<&::ethcore::client::BlockChainClient> {
fn as_full_client(&self) -> Option<&dyn (::ethcore::client::BlockChainClient)> {
None
}

View File

@@ -65,7 +65,7 @@ pub struct Service<T> {
impl<T: ChainDataFetcher> Service<T> {
/// Start the service: initialize I/O workers and client itself.
pub fn start(config: ClientConfig, spec: &Spec, fetcher: T, db: Arc<BlockChainDB>, cache: Arc<Mutex<Cache>>) -> Result<Self, Error> {
pub fn start(config: ClientConfig, spec: &Spec, fetcher: T, db: Arc<dyn BlockChainDB>, cache: Arc<Mutex<Cache>>) -> Result<Self, Error> {
let io_service = IoService::<ClientIoMessage>::start().map_err(Error::Io)?;
let client = Arc::new(Client::new(config,
db.key_value().clone(),
@@ -85,12 +85,12 @@ impl<T: ChainDataFetcher> Service<T> {
}
/// Set the actor to be notified on certain chain events
pub fn add_notify(&self, notify: Arc<LightChainNotify>) {
pub fn add_notify(&self, notify: Arc<dyn LightChainNotify>) {
self.client.add_listener(Arc::downgrade(&notify));
}
/// Register an I/O handler on the service.
pub fn register_handler(&self, handler: Arc<IoHandler<ClientIoMessage> + Send>) -> Result<(), IoError> {
pub fn register_handler(&self, handler: Arc<dyn IoHandler<ClientIoMessage> + Send>) -> Result<(), IoError> {
self.io_service.register_handler(handler)
}