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

@@ -37,13 +37,13 @@ mod helpers;
pub use self::migration::migrate;
struct AppDB {
key_value: Arc<KeyValueDB>,
key_value: Arc<dyn KeyValueDB>,
blooms: blooms_db::Database,
trace_blooms: blooms_db::Database,
}
impl BlockChainDB for AppDB {
fn key_value(&self) -> &Arc<KeyValueDB> {
fn key_value(&self) -> &Arc<dyn KeyValueDB> {
&self.key_value
}
@@ -58,7 +58,7 @@ impl BlockChainDB for AppDB {
/// Open a secret store DB using the given secret store data path. The DB path is one level beneath the data path.
#[cfg(feature = "secretstore")]
pub fn open_secretstore_db(data_path: &str) -> Result<Arc<KeyValueDB>, String> {
pub fn open_secretstore_db(data_path: &str) -> Result<Arc<dyn KeyValueDB>, String> {
use std::path::PathBuf;
let mut db_path = PathBuf::from(data_path);
@@ -68,7 +68,7 @@ pub fn open_secretstore_db(data_path: &str) -> Result<Arc<KeyValueDB>, String> {
}
/// Create a restoration db handler using the config generated by `client_path` and `client_config`.
pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) -> Box<BlockChainDBHandler> {
pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig) -> Box<dyn BlockChainDBHandler> {
let client_db_config = helpers::client_db_config(client_path, client_config);
struct RestorationDBHandler {
@@ -76,7 +76,7 @@ pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig)
}
impl BlockChainDBHandler for RestorationDBHandler {
fn open(&self, db_path: &Path) -> io::Result<Arc<BlockChainDB>> {
fn open(&self, db_path: &Path) -> io::Result<Arc<dyn BlockChainDB>> {
open_database(&db_path.to_string_lossy(), &self.config)
}
}
@@ -87,7 +87,11 @@ pub fn restoration_db_handler(client_path: &Path, client_config: &ClientConfig)
}
/// Open a new main DB.
pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &DatabaseCompactionProfile) -> io::Result<Arc<BlockChainDB>> {
pub fn open_db(
client_path: &str,
cache_config: &CacheConfig,
compaction: &DatabaseCompactionProfile
) -> io::Result<Arc<dyn BlockChainDB>> {
let path = Path::new(client_path);
let db_config = DatabaseConfig {
@@ -99,7 +103,7 @@ pub fn open_db(client_path: &str, cache_config: &CacheConfig, compaction: &Datab
open_database(client_path, &db_config)
}
pub fn open_database(client_path: &str, config: &DatabaseConfig) -> io::Result<Arc<BlockChainDB>> {
pub fn open_database(client_path: &str, config: &DatabaseConfig) -> io::Result<Arc<dyn BlockChainDB>> {
let path = Path::new(client_path);
let blooms_path = path.join("blooms");