From 5917290562511487e95a1504ae7e087447d9c9e8 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 22 Feb 2016 13:59:25 +0100 Subject: [PATCH] Remove unneeded code, fix minor potential issue with length. --- util/src/network/discovery.rs | 3 --- util/src/network/node_table.rs | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/util/src/network/discovery.rs b/util/src/network/discovery.rs index 01d2da52c..e2fd1c269 100644 --- a/util/src/network/discovery.rs +++ b/util/src/network/discovery.rs @@ -276,9 +276,6 @@ impl Discovery { } pub fn writable(&mut self) { - if self.send_queue.is_empty() { - return; - } while !self.send_queue.is_empty() { let data = self.send_queue.pop_front().unwrap(); match self.udp_socket.send_to(&data.payload, &data.address) { diff --git a/util/src/network/node_table.rs b/util/src/network/node_table.rs index ec6bad2aa..868863e8c 100644 --- a/util/src/network/node_table.rs +++ b/util/src/network/node_table.rs @@ -163,7 +163,7 @@ impl Display for Node { impl FromStr for Node { type Err = UtilError; fn from_str(s: &str) -> Result { - let (id, endpoint) = if &s[0..8] == "enode://" && s.len() > 136 && &s[136..137] == "@" { + let (id, endpoint) = if s.len() > 136 && &s[0..8] == "enode://" && &s[136..137] == "@" { (try!(NodeId::from_str(&s[8..136])), try!(NodeEndpoint::from_str(&s[137..]))) } else {