fix compile warnings (#10993)

* fix warnings

* fix: failing build, use `spec` as dev-dependency
This commit is contained in:
Niklas Adolfsson
2019-08-27 17:29:33 +02:00
committed by Andronik Ordian
parent 505e284932
commit dab2a6bd4b
69 changed files with 203 additions and 199 deletions

View File

@@ -138,7 +138,7 @@ pub enum Error {
}
impl error::Error for Error {
fn source(&self) -> Option<&(error::Error + 'static)> {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self {
Error::Io(e) => Some(e),
Error::Decoder(e) => Some(e),

View File

@@ -63,7 +63,6 @@ extern crate transaction_pool as txpool;
extern crate url;
#[macro_use]
extern crate log as ethlog;
#[macro_use]
extern crate ethabi_derive;
#[macro_use]
extern crate ethabi_contract;
@@ -205,17 +204,17 @@ impl Signer for KeyPairSigner {
/// Manager of private transactions
pub struct Provider {
encryptor: Box<Encryptor>,
encryptor: Box<dyn Encryptor>,
validator_accounts: HashSet<Address>,
signer_account: Option<Address>,
notify: RwLock<Vec<Weak<ChainNotify>>>,
notify: RwLock<Vec<Weak<dyn ChainNotify>>>,
transactions_for_signing: RwLock<SigningStore>,
transactions_for_verification: VerificationStore,
client: Arc<Client>,
miner: Arc<Miner>,
accounts: Arc<Signer>,
accounts: Arc<dyn Signer>,
channel: IoChannel<ClientIoMessage>,
keys_provider: Arc<KeyProvider>,
keys_provider: Arc<dyn KeyProvider>,
logging: Option<Logging>,
use_offchain_storage: bool,
state_storage: PrivateStateStorage,
@@ -234,12 +233,12 @@ impl Provider {
pub fn new(
client: Arc<Client>,
miner: Arc<Miner>,
accounts: Arc<Signer>,
encryptor: Box<Encryptor>,
accounts: Arc<dyn Signer>,
encryptor: Box<dyn Encryptor>,
config: ProviderConfig,
channel: IoChannel<ClientIoMessage>,
keys_provider: Arc<KeyProvider>,
db: Arc<KeyValueDB>,
keys_provider: Arc<dyn KeyProvider>,
db: Arc<dyn KeyValueDB>,
) -> Self {
keys_provider.update_acl_contract();
Provider {
@@ -268,11 +267,11 @@ impl Provider {
// TODO [ToDr] Don't use `ChainNotify` here!
// Better to create a separate notification type for this.
/// Adds an actor to be notified on certain events
pub fn add_notify(&self, target: Arc<ChainNotify>) {
pub fn add_notify(&self, target: Arc<dyn ChainNotify>) {
self.notify.write().push(Arc::downgrade(&target));
}
fn notify<F>(&self, f: F) where F: Fn(&ChainNotify) {
fn notify<F>(&self, f: F) where F: Fn(&dyn ChainNotify) {
for np in self.notify.read().iter() {
if let Some(n) = np.upgrade() {
f(&*n);

View File

@@ -186,13 +186,13 @@ impl LogsSerializer for FileLogsSerializer {
/// Private transactions logging
pub struct Logging {
logs: RwLock<HashMap<H256, TransactionLog>>,
logs_serializer: Arc<LogsSerializer>,
logs_serializer: Arc<dyn LogsSerializer>,
mono_time: MonoTime,
}
impl Logging {
/// Creates the logging object
pub fn new(logs_serializer: Arc<LogsSerializer>) -> Self {
pub fn new(logs_serializer: Arc<dyn LogsSerializer>) -> Self {
let mut logging = Logging {
logs: RwLock::new(HashMap::new()),
logs_serializer,

View File

@@ -25,12 +25,12 @@ use error::Error;
/// Wrapper around local db with private state for sync purposes
pub struct PrivateStateDB {
db: Arc<KeyValueDB>,
db: Arc<dyn KeyValueDB>,
}
impl PrivateStateDB {
/// Constructs the object
pub fn new(db: Arc<KeyValueDB>) -> Self {
pub fn new(db: Arc<dyn KeyValueDB>) -> Self {
PrivateStateDB {
db,
}
@@ -59,4 +59,4 @@ impl PrivateStateDB {
pub fn state_hash(&self, state: &Bytes) -> Result<H256, Error> {
Ok(KeccakHasher::hash(state))
}
}
}

View File

@@ -57,7 +57,7 @@ pub struct PrivateStateStorage {
impl PrivateStateStorage {
/// Constructs the object
pub fn new(db: Arc<KeyValueDB>) -> Self {
pub fn new(db: Arc<dyn KeyValueDB>) -> Self {
PrivateStateStorage {
private_state_db: Arc::new(PrivateStateDB::new(db)),
requests: RwLock::new(Vec::new()),
@@ -162,4 +162,4 @@ impl PrivateStateStorage {
!delete_request
});
}
}
}