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" name = "ethcore-accounts"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"common-types 0.1.0",
"ethereum-types 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"ethstore 0.2.1", "ethstore 0.2.1",

View File

@ -8,7 +8,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
common-types = { path = "../ethcore/types" }
ethkey = { path = "ethkey" } ethkey = { path = "ethkey" }
ethstore = { path = "ethstore" } ethstore = { path = "ethstore" }
log = "0.4" 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. /// Create a new file and restrict permissions to owner only. It errors if the file already exists.
#[cfg(unix)] #[cfg(unix)]
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> { pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
fs::OpenOptions::new() 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. /// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists.
#[cfg(unix)] #[cfg(unix)]
pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> { pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
let file = fs::File::create(file_path)?; let file = fs::File::create(file_path)?;

View File

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

View File

@ -106,8 +106,8 @@ impl ConnectionFilter for NodeFilter {
}); });
let mut cache = self.cache.write(); let mut cache = self.cache.write();
if cache.cache.len() == CACHE_SIZE { if cache.cache.len() == CACHE_SIZE {
let poped = cache.order.pop_front().unwrap(); 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(&poped).is_none(); cache.cache.remove(&popped);
}; };
if cache.cache.insert(*connecting_id, allowed).is_none() { if cache.cache.insert(*connecting_id, allowed).is_none() {
cache.order.push_back(*connecting_id); cache.order.push_back(*connecting_id);

View File

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

View File

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

View File

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