fix compile warnings (#10993)
* fix warnings * fix: failing build, use `spec` as dev-dependency
This commit is contained in:
committed by
Andronik Ordian
parent
505e284932
commit
dab2a6bd4b
@@ -67,7 +67,7 @@ pub(crate) fn serde_error(expected: &str, field: Option<&str>) -> ErrorKind {
|
||||
}
|
||||
|
||||
impl Fail for Error {
|
||||
fn cause(&self) -> Option<&Fail> {
|
||||
fn cause(&self) -> Option<&dyn Fail> {
|
||||
self.inner.cause()
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ impl Client {
|
||||
}
|
||||
|
||||
impl Fetch for Client {
|
||||
type Result = Box<Future<Item=Response, Error=Error> + Send + 'static>;
|
||||
type Result = Box<dyn Future<Item=Response, Error=Error> + Send + 'static>;
|
||||
|
||||
fn fetch(&self, request: Request, abort: Abort) -> Self::Result {
|
||||
debug!(target: "fetch", "fetching: {:?}", request.url());
|
||||
@@ -608,7 +608,7 @@ impl fmt::Display for Error {
|
||||
|
||||
impl ::std::error::Error for Error {
|
||||
fn description(&self) -> &str { "Fetch client error" }
|
||||
fn cause(&self) -> Option<&::std::error::Error> { None }
|
||||
fn cause(&self) -> Option<&dyn std::error::Error> { None }
|
||||
}
|
||||
|
||||
impl From<hyper::Error> for Error {
|
||||
|
||||
@@ -32,7 +32,7 @@ use std::{fs, io, error};
|
||||
use kvdb::DBTransaction;
|
||||
use kvdb_rocksdb::{CompactionProfile, Database, DatabaseConfig};
|
||||
|
||||
fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<error::Error + Send + Sync>> {
|
||||
fn other_io_err<E>(e: E) -> io::Error where E: Into<Box<dyn error::Error + Send + Sync>> {
|
||||
io::Error::new(io::ErrorKind::Other, e)
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ impl TempIndex {
|
||||
/// Manages database migration.
|
||||
pub struct Manager {
|
||||
config: Config,
|
||||
migrations: Vec<Box<Migration>>,
|
||||
migrations: Vec<Box<dyn Migration>>,
|
||||
}
|
||||
|
||||
impl Manager {
|
||||
@@ -317,7 +317,7 @@ impl Manager {
|
||||
}
|
||||
|
||||
/// Find all needed migrations.
|
||||
fn migrations_from(&mut self, version: u32) -> Vec<&mut Box<Migration>> {
|
||||
fn migrations_from(&mut self, version: u32) -> Vec<&mut Box<dyn Migration>> {
|
||||
self.migrations.iter_mut().filter(|m| m.version() > version).collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ impl SocketAddrExt for Ipv4Addr {
|
||||
self.is_multicast() ||
|
||||
self.is_shared_space() ||
|
||||
self.is_special_purpose() ||
|
||||
self.is_benchmarking() ||
|
||||
SocketAddrExt::is_benchmarking(self) ||
|
||||
self.is_future_use()
|
||||
}
|
||||
|
||||
fn is_usable_public(&self) -> bool {
|
||||
!self.is_reserved() &&
|
||||
!SocketAddrExt::is_reserved(self) &&
|
||||
!self.is_private()
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ impl SocketAddrExt for IpAddr {
|
||||
|
||||
fn is_reserved(&self) -> bool {
|
||||
match *self {
|
||||
IpAddr::V4(ref ip) => ip.is_reserved(),
|
||||
IpAddr::V4(ref ip) => SocketAddrExt::is_reserved(ip),
|
||||
IpAddr::V6(ref ip) => ip.is_reserved(),
|
||||
}
|
||||
}
|
||||
@@ -290,7 +290,7 @@ pub fn select_public_address(port: u16) -> SocketAddr {
|
||||
//prefer IPV4 bindings
|
||||
for addr in &list { //TODO: use better criteria than just the first in the list
|
||||
match addr {
|
||||
IpAddr::V4(a) if !a.is_reserved() => {
|
||||
IpAddr::V4(a) if !SocketAddrExt::is_reserved(a) => {
|
||||
return SocketAddr::V4(SocketAddrV4::new(*a, port));
|
||||
},
|
||||
_ => {},
|
||||
|
||||
@@ -145,7 +145,7 @@ impl From<Option<io::Error>> for AddressResolveError {
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn source(&self) -> Option<&(error::Error + 'static)> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
match self {
|
||||
Error::Decompression(e) => Some(e),
|
||||
Error::Rlp(e) => Some(e),
|
||||
|
||||
@@ -75,7 +75,7 @@ pub enum NetworkIoMessage {
|
||||
/// Register a new protocol handler.
|
||||
AddHandler {
|
||||
/// Handler shared instance.
|
||||
handler: Arc<NetworkProtocolHandler + Sync>,
|
||||
handler: Arc<dyn NetworkProtocolHandler + Sync>,
|
||||
/// Protocol Id.
|
||||
protocol: ProtocolId,
|
||||
/// Supported protocol versions and number of packet IDs reserved by the protocol (packet count).
|
||||
@@ -361,15 +361,15 @@ impl<'a, T> NetworkContext for &'a T where T: ?Sized + NetworkContext {
|
||||
/// `Message` is the type for message data.
|
||||
pub trait NetworkProtocolHandler: Sync + Send {
|
||||
/// Initialize the handler
|
||||
fn initialize(&self, _io: &NetworkContext) {}
|
||||
fn initialize(&self, _io: &dyn NetworkContext) {}
|
||||
/// Called when new network packet received.
|
||||
fn read(&self, io: &NetworkContext, peer: &PeerId, packet_id: u8, data: &[u8]);
|
||||
fn read(&self, io: &dyn NetworkContext, peer: &PeerId, packet_id: u8, data: &[u8]);
|
||||
/// Called when new peer is connected. Only called when peer supports the same protocol.
|
||||
fn connected(&self, io: &NetworkContext, peer: &PeerId);
|
||||
fn connected(&self, io: &dyn NetworkContext, peer: &PeerId);
|
||||
/// Called when a previously connected peer disconnects.
|
||||
fn disconnected(&self, io: &NetworkContext, peer: &PeerId);
|
||||
fn disconnected(&self, io: &dyn NetworkContext, peer: &PeerId);
|
||||
/// Timer function called after a timeout created with `NetworkContext::timeout`.
|
||||
fn timeout(&self, _io: &NetworkContext, _timer: TimerToken) {}
|
||||
fn timeout(&self, _io: &dyn NetworkContext, _timer: TimerToken) {}
|
||||
}
|
||||
|
||||
/// Non-reserved peer modes.
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
extern crate futures;
|
||||
extern crate ethabi;
|
||||
extern crate ethabi_derive;
|
||||
extern crate keccak_hash;
|
||||
|
||||
#[macro_use]
|
||||
extern crate ethabi_derive;
|
||||
#[macro_use]
|
||||
extern crate ethabi_contract;
|
||||
|
||||
|
||||
@@ -24,25 +24,25 @@ use_contract!(registrar, "res/registrar.json");
|
||||
// Maps a domain name to an Ethereum address
|
||||
const DNS_A_RECORD: &'static str = "A";
|
||||
|
||||
pub type Asynchronous = Box<Future<Item=Bytes, Error=String> + Send>;
|
||||
pub type Asynchronous = Box<dyn Future<Item=Bytes, Error=String> + Send>;
|
||||
pub type Synchronous = Result<Bytes, String>;
|
||||
|
||||
/// Registrar is dedicated interface to access the registrar contract
|
||||
/// which in turn generates an address when a client requests one
|
||||
pub struct Registrar {
|
||||
client: Arc<RegistrarClient<Call=Asynchronous>>,
|
||||
client: Arc<dyn RegistrarClient<Call=Asynchronous>>,
|
||||
}
|
||||
|
||||
impl Registrar {
|
||||
/// Registrar constructor
|
||||
pub fn new(client: Arc<RegistrarClient<Call=Asynchronous>>) -> Self {
|
||||
pub fn new(client: Arc<dyn RegistrarClient<Call=Asynchronous>>) -> Self {
|
||||
Self {
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate an address for the given key
|
||||
pub fn get_address<'a>(&self, key: &'a str) -> Box<Future<Item = Address, Error = String> + Send> {
|
||||
pub fn get_address<'a>(&self, key: &'a str) -> Box<dyn Future<Item = Address, Error = String> + Send> {
|
||||
// Address of the registrar itself
|
||||
let registrar_address = match self.client.registrar_address() {
|
||||
Ok(a) => a,
|
||||
|
||||
@@ -40,7 +40,7 @@ pub trait Decompressor {
|
||||
}
|
||||
|
||||
/// Call this function to compress rlp.
|
||||
pub fn compress(c: &[u8], swapper: &Compressor) -> ElasticArray1024<u8> {
|
||||
pub fn compress(c: &[u8], swapper: &dyn Compressor) -> ElasticArray1024<u8> {
|
||||
let rlp = Rlp::new(c);
|
||||
if rlp.is_data() {
|
||||
ElasticArray1024::from_slice(swapper.compressed(rlp.as_raw()).unwrap_or_else(|| rlp.as_raw()))
|
||||
@@ -50,7 +50,7 @@ pub fn compress(c: &[u8], swapper: &Compressor) -> ElasticArray1024<u8> {
|
||||
}
|
||||
|
||||
/// Call this function to decompress rlp.
|
||||
pub fn decompress(c: &[u8], swapper: &Decompressor) -> ElasticArray1024<u8> {
|
||||
pub fn decompress(c: &[u8], swapper: &dyn Decompressor) -> ElasticArray1024<u8> {
|
||||
let rlp = Rlp::new(c);
|
||||
if rlp.is_data() {
|
||||
ElasticArray1024::from_slice(swapper.decompressed(rlp.as_raw()).unwrap_or_else(|| rlp.as_raw()))
|
||||
|
||||
Reference in New Issue
Block a user