From 6a6ffcb57470265c0777f7d965db97481821b907 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Tue, 21 Jan 2020 20:28:04 +0900 Subject: [PATCH 1/3] Fix: trait objects without an explicit `dyn` are deprecated --- src/net/mod.rs | 20 ++++++++++---------- src/rpc/filter.rs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/net/mod.rs b/src/net/mod.rs index d263f6c..6b6b6ab 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -686,26 +686,26 @@ impl Network { } impl ::network::NetworkProtocolHandler for Network { - fn initialize(&self, io: &NetworkContext) { + fn initialize(&self, io: &dyn NetworkContext) { // set up broadcast timer (< 1s) io.register_timer(RALLY_TOKEN, RALLY_TIMEOUT) .expect("Failed to initialize message rally timer"); } - 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]) { self.on_packet(io, peer, packet_id, data) } - fn connected(&self, io: &NetworkContext, peer: &PeerId) { + fn connected(&self, io: &dyn NetworkContext, peer: &PeerId) { // peer with higher ID should begin rallying. self.on_connect(io, peer) } - fn disconnected(&self, _io: &NetworkContext, peer: &PeerId) { + fn disconnected(&self, _io: &dyn NetworkContext, peer: &PeerId) { self.on_disconnect(peer) } - fn timeout(&self, io: &NetworkContext, timer: TimerToken) { + fn timeout(&self, io: &dyn NetworkContext, timer: TimerToken) { // rally with each peer and handle timeouts. match timer { RALLY_TOKEN => self.rally(io), @@ -719,13 +719,13 @@ impl ::network::NetworkProtocolHandler for Network { pub struct ParityExtensions; impl ::network::NetworkProtocolHandler for ParityExtensions { - fn initialize(&self, _io: &NetworkContext) { } + fn initialize(&self, _io: &dyn NetworkContext) { } - fn read(&self, _io: &NetworkContext, _peer: &PeerId, _id: u8, _msg: &[u8]) { } + fn read(&self, _io: &dyn NetworkContext, _peer: &PeerId, _id: u8, _msg: &[u8]) { } - fn connected(&self, _io: &NetworkContext, _peer: &PeerId) { } + fn connected(&self, _io: &dyn NetworkContext, _peer: &PeerId) { } - fn disconnected(&self, _io: &NetworkContext, _peer: &PeerId) { } + fn disconnected(&self, _io: &dyn NetworkContext, _peer: &PeerId) { } - fn timeout(&self, _io: &NetworkContext, _timer: TimerToken) { } + fn timeout(&self, _io: &dyn NetworkContext, _timer: TimerToken) { } } diff --git a/src/rpc/filter.rs b/src/rpc/filter.rs index 84a6445..604615c 100644 --- a/src/rpc/filter.rs +++ b/src/rpc/filter.rs @@ -48,7 +48,7 @@ enum FilterEntry { pub struct Manager { key_store: Arc>, filters: RwLock>, - tx: Mutex>>, + tx: Mutex>>, join: Option>, exit: Arc, } @@ -57,7 +57,7 @@ impl Manager { /// Create a new filter manager that will dispatch decryption tasks onto /// the given thread pool. pub fn new() -> ::std::io::Result { - let (tx, rx) = mpsc::channel::>(); + let (tx, rx) = mpsc::channel::>(); let exit = Arc::new(AtomicBool::new(false)); let e = exit.clone(); From 26c53b9664b84be43b7bfd41310bd3fbc94f61fa Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Tue, 21 Jan 2020 20:31:11 +0900 Subject: [PATCH 2/3] Fix: unused import: `ethereum_types::H256` --- src/message.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/message.rs b/src/message.rs index cf12d65..a72f187 100644 --- a/src/message.rs +++ b/src/message.rs @@ -461,7 +461,6 @@ impl Message { #[cfg(test)] mod tests { - use ethereum_types::H256; use super::*; use std::time::{self, Duration, SystemTime}; use rlp::Rlp; From b932a780fd30bca24cbd3f0e7b95985ef385570c Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Tue, 21 Jan 2020 20:34:03 +0900 Subject: [PATCH 3/3] Fix: `...` range patterns are deprecated --- src/rpc/payload.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/payload.rs b/src/rpc/payload.rs index 326a6b6..40f6b7c 100644 --- a/src/rpc/payload.rs +++ b/src/rpc/payload.rs @@ -66,9 +66,9 @@ fn num_padding_length_bytes(padding_len: usize) -> Option { let bits = 64 - (padding_len as u64).leading_zeros(); match bits { 0 => Some(0), - 0 ... 8 => Some(1), - 0 ... 16 => Some(2), - 0 ... 24 => Some(3), + 0 ..= 8 => Some(1), + 0 ..= 16 => Some(2), + 0 ..= 24 => Some(3), _ => None, } }