It's Clippy time (#3806)

Fix some Clippy issues
This commit is contained in:
Caio
2019-10-19 08:01:51 -03:00
committed by Bastian Köcher
parent 470b62366f
commit f5162edc83
13 changed files with 18 additions and 31 deletions
@@ -91,7 +91,7 @@ impl BabePreDigest {
}
/// The prefix used by BABE for its VRF keys.
pub const BABE_VRF_PREFIX: &'static [u8] = b"substrate-babe-vrf";
pub const BABE_VRF_PREFIX: &[u8] = b"substrate-babe-vrf";
/// A raw version of `BabePreDigest`, usable on `no_std`.
#[derive(Copy, Clone, Encode, Decode)]
@@ -38,7 +38,7 @@ fn load_decode<B, T>(backend: &B, key: &[u8]) -> ClientResult<Option<T>>
T: Decode,
{
let corrupt = |e: codec::Error| {
ClientError::Backend(format!("BABE DB is corrupted. Decode error: {}", e.what())).into()
ClientError::Backend(format!("BABE DB is corrupted. Decode error: {}", e.what()))
};
match backend.get_aux(key)? {
None => Ok(None),
@@ -38,7 +38,7 @@ fn load_decode<C, T>(backend: &C, key: &[u8]) -> ClientResult<Option<T>>
None => Ok(None),
Some(t) => T::decode(&mut &t[..])
.map_err(
|e| ClientError::Backend(format!("Slots DB is corrupted. Decode error: {}", e.what())).into(),
|e| ClientError::Backend(format!("Slots DB is corrupted. Decode error: {}", e.what())),
)
.map(Some)
}
+5 -6
View File
@@ -189,9 +189,9 @@ pub trait SimpleSlotWorker<B: BlockT> {
logs,
},
remaining_duration,
).map_err(|e| consensus_common::Error::ClientImport(format!("{:?}", e)).into()),
).map_err(|e| consensus_common::Error::ClientImport(format!("{:?}", e))),
Delay::new(remaining_duration)
.map_err(|err| consensus_common::Error::FaultyTimer(err).into())
.map_err(consensus_common::Error::FaultyTimer)
).map(|v| match v {
futures::future::Either::Left((b, _)) => b.map(|b| (b, claim)),
futures::future::Either::Right((Ok(_), _)) =>
@@ -220,9 +220,9 @@ pub trait SimpleSlotWorker<B: BlockT> {
}
let (header, body) = block.deconstruct();
let header_num = header.number().clone();
let header_num = *header.number();
let header_hash = header.hash();
let parent_hash = header.parent_hash().clone();
let parent_hash = *header.parent_hash();
let block_import_params = block_import_params_maker(
header,
@@ -401,9 +401,8 @@ impl<T: Clone> SlotDuration<T> {
.map_err(|_| {
client::error::Error::Backend({
error!(target: "slots", "slot duration kept in invalid format");
format!("slot duration kept in invalid format")
"slot duration kept in invalid format".to_string()
})
.into()
}),
None => {
use sr_primitives::traits::Zero;