From 24542e899c73d179447807b1affd8ccd679d1eb4 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 11 Jan 2019 17:33:43 +0100 Subject: [PATCH] Fix all current warnings (#45) * Fix warnings in primitives * Fix all warnings for no_std * Fix warnings in consensus and cli --- consensus/src/lib.rs | 7 +++---- primitives/src/attestation.rs | 1 - primitives/src/authority_id.rs | 1 - primitives/src/lib.rs | 3 --- primitives/src/signature.rs | 1 - runtime/src/consts.rs | 1 - runtime/src/digest.rs | 1 - runtime/src/lib.rs | 2 +- src/service.rs | 2 +- 9 files changed, 5 insertions(+), 14 deletions(-) diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs index 4ce1f1c4..318e486a 100644 --- a/consensus/src/lib.rs +++ b/consensus/src/lib.rs @@ -59,7 +59,7 @@ pub use proposer::{ProposerFactory, Proposer}; use std::sync::Arc; use std::time::{Duration, Instant}; -use std::collections::hash_map::{HashMap, Entry}; +use std::collections::hash_map::{HashMap}; use codec::Encode; use consensus_common::{Authorities, BlockImport, Environment, Proposer as ProposerT, ImportBlock, BlockOrigin, ForkChoiceStrategy, Error as ConsensusError}; @@ -68,9 +68,8 @@ use client::{blockchain::HeaderBackend, ChainHead}; use client::backend::AuxStore; use client::block_builder::api::BlockBuilder as BlockBuilderApi; use runtime_primitives::{generic::BlockId, Justification, BasicInherentData}; -use runtime_primitives::traits::{Block, Header, Digest, DigestItemFor, DigestItem, ProvideRuntimeApi, One}; +use runtime_primitives::traits::{Block, Header, Digest, DigestItemFor, DigestItem, ProvideRuntimeApi}; use shasper_primitives::{ValidatorId, H256, Slot}; -use parking_lot::Mutex; use futures::{Stream, Future, IntoFuture, future::{self, Either}}; use tokio::timer::{Delay, Timeout}; @@ -131,7 +130,7 @@ fn timestamp_and_slot_now(slot_duration: u64) -> Option<(u64, u64)> { } /// Get the slot for now. -fn slot_now(slot_duration: u64) -> Option { +pub fn slot_now(slot_duration: u64) -> Option { duration_now().map(|s| s.as_secs() / slot_duration) } diff --git a/primitives/src/attestation.rs b/primitives/src/attestation.rs index 49c0b7e3..d3c4bd1f 100644 --- a/primitives/src/attestation.rs +++ b/primitives/src/attestation.rs @@ -19,7 +19,6 @@ use rstd::prelude::*; use super::{H256, ValidatorId, ShardId, BitField, Signature}; use hash_db::Hasher; use keccak_hasher::KeccakHasher; -use crypto::bls; #[derive(Clone, PartialEq, Eq, Decode, Encode, SszEncode, SszDecode, SszHash)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] diff --git a/primitives/src/authority_id.rs b/primitives/src/authority_id.rs index 4327e8e1..584fed43 100644 --- a/primitives/src/authority_id.rs +++ b/primitives/src/authority_id.rs @@ -18,7 +18,6 @@ use serde::{Serialize, Serializer, Deserialize, Deserializer}; use primitives::H256; use crypto::bls; -use rstd::vec::Vec; #[cfg(feature = "std")] use primitives::bytes; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index ce29bd83..d75e144a 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -46,9 +46,6 @@ mod bitfield; mod attestation; mod signature; -use runtime_primitives::generic; -use runtime_primitives::traits::{BlakeTwo256, Extrinsic as ExtrinsicT}; - pub use signature::{H768, Signature}; pub use authority_id::{H384, AuthorityId}; pub use bitfield::BitField; diff --git a/primitives/src/signature.rs b/primitives/src/signature.rs index da319121..d823926e 100644 --- a/primitives/src/signature.rs +++ b/primitives/src/signature.rs @@ -17,7 +17,6 @@ #[cfg(feature = "std")] use serde::{Serialize, Serializer, Deserialize, Deserializer}; use crypto::bls; -use rstd::vec::Vec; #[cfg(feature = "std")] use primitives::bytes; diff --git a/runtime/src/consts.rs b/runtime/src/consts.rs index 42969cb0..8dd4f443 100644 --- a/runtime/src/consts.rs +++ b/runtime/src/consts.rs @@ -27,4 +27,3 @@ pub const TIMESTAMP_POSITION: u32 = 0; pub const SLOT_POSITION: u32 = 1; pub const RANDAO_REVEAL_POSITION: u32 = 2; pub const POW_CHAIN_REF_POSITION: u32 = 3; -pub const ATTESTATION_START_POSITION: u32 = 4; diff --git a/runtime/src/digest.rs b/runtime/src/digest.rs index f38a29e9..8d860c9b 100644 --- a/runtime/src/digest.rs +++ b/runtime/src/digest.rs @@ -16,7 +16,6 @@ use primitives::{H256, ValidatorId}; use runtime_primitives::traits; -use crypto::bls; use rstd::prelude::*; #[derive(PartialEq, Eq, Clone, Encode, Decode)] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 3af0c529..3999acd9 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -68,7 +68,7 @@ use primitives::{Slot, H256, ValidatorId, OpaqueMetadata}; use client::block_builder::api::runtime_decl_for_BlockBuilder::BlockBuilder; use runtime_primitives::{ ApplyResult, transaction_validity::TransactionValidity, generic, - traits::{self, Block as BlockT, GetNodeBlockType, GetRuntimeBlockType, BlakeTwo256, Hash as HashT}, + traits::{Block as BlockT, GetNodeBlockType, GetRuntimeBlockType, BlakeTwo256, Hash as HashT}, BasicInherentData, CheckInherentError, ApplyOutcome, }; use client::{ diff --git a/src/service.rs b/src/service.rs index 711c2d9e..e6cc95e6 100644 --- a/src/service.rs +++ b/src/service.rs @@ -29,7 +29,7 @@ use substrate_service::{ FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, TaskExecutor, }; -use consensus::{import_queue, start_aura, AuraImportQueue, NothingExtra, SlotDuration, LatestAttestations, ShasperBlockImport}; +use consensus::{import_queue, start_aura, AuraImportQueue, NothingExtra, SlotDuration, ShasperBlockImport}; use client; use crypto::bls; -- GitLab