Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build warnings #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,26 +686,26 @@ impl<T: MessageHandler> Network<T> {
}

impl<T: MessageHandler> ::network::NetworkProtocolHandler for Network<T> {
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),
Expand All @@ -719,13 +719,13 @@ impl<T: MessageHandler> ::network::NetworkProtocolHandler for Network<T> {
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) { }
}
4 changes: 2 additions & 2 deletions src/rpc/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum FilterEntry {
pub struct Manager {
key_store: Arc<RwLock<KeyStore>>,
filters: RwLock<HashMap<H256, FilterEntry>>,
tx: Mutex<mpsc::Sender<Box<Fn() + Send>>>,
tx: Mutex<mpsc::Sender<Box<dyn Fn() + Send>>>,
join: Option<thread::JoinHandle<()>>,
exit: Arc<AtomicBool>,
}
Expand All @@ -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<Self> {
let (tx, rx) = mpsc::channel::<Box<Fn() + Send>>();
let (tx, rx) = mpsc::channel::<Box<dyn Fn() + Send>>();
let exit = Arc::new(AtomicBool::new(false));
let e = exit.clone();

Expand Down
6 changes: 3 additions & 3 deletions src/rpc/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ fn num_padding_length_bytes(padding_len: usize) -> Option<usize> {
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,
}
}
Expand Down