Fix tons of warnings in newest nightly (#2784)

* Fix tons of warnings in newest nightly

* Fix sr-api-macro doc tests
This commit is contained in:
Bastian Köcher
2019-06-04 20:09:49 +02:00
committed by GitHub
parent 9700029203
commit 6142f95611
73 changed files with 359 additions and 316 deletions
+16 -9
View File
@@ -17,9 +17,7 @@
//! Db-based backend utility structures and functions, used by both
//! full and light storages.
use std::sync::Arc;
use std::io;
use std::convert::TryInto;
use std::{io, convert::TryInto, sync::Arc};
use kvdb::{KeyValueDB, DBTransaction};
#[cfg(feature = "kvdb-rocksdb")]
@@ -171,7 +169,7 @@ pub fn insert_hash_to_key_mapping<N: TryInto<u32>, H: AsRef<[u8]> + Clone>(
/// block lookup key is the DB-key header, block and justification are stored under.
/// looks up lookup key by hash from DB as necessary.
pub fn block_id_to_lookup_key<Block>(
db: &KeyValueDB,
db: &dyn KeyValueDB,
key_lookup_col: Option<u32>,
id: BlockId<Block>
) -> Result<Option<Vec<u8>>, client::error::Error> where
@@ -197,7 +195,11 @@ pub fn db_err(err: io::Error) -> client::error::Error {
/// Open RocksDB database.
#[cfg(feature = "kvdb-rocksdb")]
pub fn open_database(config: &DatabaseSettings, col_meta: Option<u32>, db_type: &str) -> client::error::Result<Arc<KeyValueDB>> {
pub fn open_database(
config: &DatabaseSettings,
col_meta: Option<u32>,
db_type: &str
) -> client::error::Result<Arc<dyn KeyValueDB>> {
let mut db_config = DatabaseConfig::with_columns(Some(NUM_COLUMNS));
db_config.memory_budget = config.cache_size;
let path = config.path.to_str().ok_or_else(|| client::error::Error::Backend("Invalid database path".into()))?;
@@ -222,7 +224,12 @@ pub fn open_database(config: &DatabaseSettings, col_meta: Option<u32>, db_type:
}
/// Read database column entry for the given block.
pub fn read_db<Block>(db: &KeyValueDB, col_index: Option<u32>, col: Option<u32>, id: BlockId<Block>) -> client::error::Result<Option<DBValue>>
pub fn read_db<Block>(
db: &dyn KeyValueDB,
col_index: Option<u32>,
col: Option<u32>,
id: BlockId<Block>
) -> client::error::Result<Option<DBValue>>
where
Block: BlockT,
{
@@ -234,7 +241,7 @@ pub fn read_db<Block>(db: &KeyValueDB, col_index: Option<u32>, col: Option<u32>,
/// Read a header from the database.
pub fn read_header<Block: BlockT>(
db: &KeyValueDB,
db: &dyn KeyValueDB,
col_index: Option<u32>,
col: Option<u32>,
id: BlockId<Block>,
@@ -252,7 +259,7 @@ pub fn read_header<Block: BlockT>(
/// Required header from the database.
pub fn require_header<Block: BlockT>(
db: &KeyValueDB,
db: &dyn KeyValueDB,
col_index: Option<u32>,
col: Option<u32>,
id: BlockId<Block>,
@@ -262,7 +269,7 @@ pub fn require_header<Block: BlockT>(
}
/// Read meta from the database.
pub fn read_meta<Block>(db: &KeyValueDB, col_meta: Option<u32>, col_header: Option<u32>) -> Result<
pub fn read_meta<Block>(db: &dyn KeyValueDB, col_meta: Option<u32>, col_header: Option<u32>) -> Result<
Meta<<<Block as BlockT>::Header as HeaderT>::Number, Block::Hash>,
client::error::Error,
>