Remove annoying compiler warnings (#10679)

This commit is contained in:
David 2019-05-21 17:12:49 +02:00 committed by Andrew Jones
parent 21a27fee9f
commit c31ffab22e
8 changed files with 32 additions and 38 deletions

1
Cargo.lock generated
View File

@ -779,7 +779,6 @@ dependencies = [
name = "ethcore-accounts"
version = "0.1.0"
dependencies = [
"common-types 0.1.0",
"ethereum-types 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0",
"ethstore 0.2.1",

View File

@ -8,7 +8,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
common-types = { path = "../ethcore/types" }
ethkey = { path = "ethkey" }
ethstore = { path = "ethstore" }
log = "0.4"

View File

@ -61,7 +61,6 @@ pub fn find_unique_filename_using_random_suffix(parent_path: &Path, original_fil
/// Create a new file and restrict permissions to owner only. It errors if the file already exists.
#[cfg(unix)]
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::OpenOptionsExt;
fs::OpenOptions::new()
@ -83,7 +82,6 @@ pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result
/// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists.
#[cfg(unix)]
pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::PermissionsExt;
let file = fs::File::create(file_path)?;

View File

@ -28,14 +28,13 @@ use self::stores::AddressBook;
use std::collections::HashMap;
use std::time::{Instant, Duration};
use common_types::transaction::{Action, Transaction};
use ethkey::{Address, Message, Public, Secret, Password, Random, Generator};
use ethstore::accounts_dir::MemoryDirectory;
use ethstore::{
SimpleSecretStore, SecretStore, EthStore, EthMultiStore,
random_string, SecretVaultRef, StoreAccountRef, OpaqueSecret,
};
use log::{warn, debug};
use log::warn;
use parking_lot::RwLock;
pub use ethkey::Signature;

View File

@ -106,8 +106,8 @@ impl ConnectionFilter for NodeFilter {
});
let mut cache = self.cache.write();
if cache.cache.len() == CACHE_SIZE {
let poped = cache.order.pop_front().unwrap();
cache.cache.remove(&poped).is_none();
let popped = cache.order.pop_front().expect("the cache is full so there's at least one item we can pop; qed");
cache.cache.remove(&popped);
};
if cache.cache.insert(*connecting_id, allowed).is_none() {
cache.order.push_back(*connecting_id);

View File

@ -847,8 +847,6 @@ impl Spec {
/// constructor.
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
use types::transaction::{Action, Transaction};
use journaldb;
use kvdb_memorydb;
let genesis = self.genesis_header();

View File

@ -25,37 +25,37 @@
use api::{ETH_PROTOCOL, WARP_SYNC_PROTOCOL_ID};
use network::{PacketId, ProtocolId};
/// An enum that defines all known packet ids in the context of
/// synchronization and provides a mechanism to convert from
/// packet ids (of type PacketId or u8) directly read from the network
/// to enum variants. This implicitly provides a mechanism to
/// check whether a given packet id is known, and to prevent
/// packet id clashes when defining new ids.
enum_from_primitive! {
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SyncPacket {
StatusPacket = 0x00,
NewBlockHashesPacket = 0x01,
TransactionsPacket = 0x02,
GetBlockHeadersPacket = 0x03,
BlockHeadersPacket = 0x04,
GetBlockBodiesPacket = 0x05,
BlockBodiesPacket = 0x06,
NewBlockPacket = 0x07,
/// An enum that defines all known packet ids in the context of
/// synchronization and provides a mechanism to convert from
/// packet ids (of type PacketId or u8) directly read from the network
/// to enum variants. This implicitly provides a mechanism to
/// check whether a given packet id is known, and to prevent
/// packet id clashes when defining new ids.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SyncPacket {
StatusPacket = 0x00,
NewBlockHashesPacket = 0x01,
TransactionsPacket = 0x02,
GetBlockHeadersPacket = 0x03,
BlockHeadersPacket = 0x04,
GetBlockBodiesPacket = 0x05,
BlockBodiesPacket = 0x06,
NewBlockPacket = 0x07,
GetNodeDataPacket = 0x0d,
NodeDataPacket = 0x0e,
GetReceiptsPacket = 0x0f,
ReceiptsPacket = 0x10,
GetNodeDataPacket = 0x0d,
NodeDataPacket = 0x0e,
GetReceiptsPacket = 0x0f,
ReceiptsPacket = 0x10,
GetSnapshotManifestPacket = 0x11,
SnapshotManifestPacket = 0x12,
GetSnapshotDataPacket = 0x13,
SnapshotDataPacket = 0x14,
ConsensusDataPacket = 0x15,
PrivateTransactionPacket = 0x16,
SignedPrivateTransactionPacket = 0x17,
}
GetSnapshotManifestPacket = 0x11,
SnapshotManifestPacket = 0x12,
GetSnapshotDataPacket = 0x13,
SnapshotDataPacket = 0x14,
ConsensusDataPacket = 0x15,
PrivateTransactionPacket = 0x16,
SignedPrivateTransactionPacket = 0x17,
}
}
use self::SyncPacket::*;

View File

@ -128,6 +128,7 @@ impl<'a, 'view> Iterator for ViewRlpIterator<'a, 'view> {
}
#[macro_export]
/// Create a view into RLP-data
macro_rules! view {
($view: ident, $bytes: expr) => {
$view::new($crate::views::ViewRlp::new($bytes, file!(), line!()))