Fix warnings: range patterns
This commit is contained in:
parent
1700873f48
commit
239cf91594
@ -279,7 +279,7 @@ impl Manager {
|
|||||||
"Not implemented. Make sure the Ledger Ethereum Wallet app is running.",
|
"Not implemented. Make sure the Ledger Ethereum Wallet app is running.",
|
||||||
)),
|
)),
|
||||||
0x6faa => Err(Error::Protocol("Your Ledger need to be unplugged")),
|
0x6faa => Err(Error::Protocol("Your Ledger need to be unplugged")),
|
||||||
0x6f00...0x6fff => Err(Error::Protocol("Internal error")),
|
0x6f00..=0x6fff => Err(Error::Protocol("Internal error")),
|
||||||
0x9000 => Ok(()),
|
0x9000 => Ok(()),
|
||||||
_ => Err(Error::Protocol("Unknown error")),
|
_ => Err(Error::Protocol("Unknown error")),
|
||||||
}?;
|
}?;
|
||||||
|
@ -1063,7 +1063,7 @@ impl Host {
|
|||||||
let mut failure_id = None;
|
let mut failure_id = None;
|
||||||
let mut deregister = false;
|
let mut deregister = false;
|
||||||
let mut expired_session = None;
|
let mut expired_session = None;
|
||||||
if let FIRST_SESSION...LAST_SESSION = token {
|
if let FIRST_SESSION..=LAST_SESSION = token {
|
||||||
let sessions = self.sessions.read();
|
let sessions = self.sessions.read();
|
||||||
if let Some(session) = sessions.get(token).cloned() {
|
if let Some(session) = sessions.get(token).cloned() {
|
||||||
expired_session = Some(session.clone());
|
expired_session = Some(session.clone());
|
||||||
@ -1167,7 +1167,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
fn stream_hup(&self, io: &IoContext<NetworkIoMessage>, stream: StreamToken) {
|
fn stream_hup(&self, io: &IoContext<NetworkIoMessage>, stream: StreamToken) {
|
||||||
trace!(target: "network", "Hup: {}", stream);
|
trace!(target: "network", "Hup: {}", stream);
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => self.connection_closed(stream, io),
|
FIRST_SESSION..=LAST_SESSION => self.connection_closed(stream, io),
|
||||||
_ => warn!(target: "network", "Unexpected hup"),
|
_ => warn!(target: "network", "Unexpected hup"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1177,7 +1177,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => self.session_readable(stream, io),
|
FIRST_SESSION..=LAST_SESSION => self.session_readable(stream, io),
|
||||||
DISCOVERY => self.discovery_readable(io),
|
DISCOVERY => self.discovery_readable(io),
|
||||||
TCP_ACCEPT => self.accept(io),
|
TCP_ACCEPT => self.accept(io),
|
||||||
_ => panic!("Received unknown readable token"),
|
_ => panic!("Received unknown readable token"),
|
||||||
@ -1189,7 +1189,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => self.session_writable(stream, io),
|
FIRST_SESSION..=LAST_SESSION => self.session_writable(stream, io),
|
||||||
DISCOVERY => self.discovery_writable(io),
|
DISCOVERY => self.discovery_writable(io),
|
||||||
_ => panic!("Received unknown writable token"),
|
_ => panic!("Received unknown writable token"),
|
||||||
}
|
}
|
||||||
@ -1201,7 +1201,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
}
|
}
|
||||||
match token {
|
match token {
|
||||||
IDLE => self.maintain_network(io),
|
IDLE => self.maintain_network(io),
|
||||||
FIRST_SESSION...LAST_SESSION => self.connection_timeout(token, io),
|
FIRST_SESSION..=LAST_SESSION => self.connection_timeout(token, io),
|
||||||
DISCOVERY_REFRESH => {
|
DISCOVERY_REFRESH => {
|
||||||
// Run the _slow_ discovery if enough peers are connected
|
// Run the _slow_ discovery if enough peers are connected
|
||||||
if !self.has_enough_peers() {
|
if !self.has_enough_peers() {
|
||||||
@ -1347,7 +1347,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
||||||
) {
|
) {
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => {
|
FIRST_SESSION..=LAST_SESSION => {
|
||||||
let session = { self.sessions.read().get(stream).cloned() };
|
let session = { self.sessions.read().get(stream).cloned() };
|
||||||
if let Some(session) = session {
|
if let Some(session) = session {
|
||||||
session
|
session
|
||||||
@ -1382,7 +1382,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
||||||
) {
|
) {
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => {
|
FIRST_SESSION..=LAST_SESSION => {
|
||||||
let mut connections = self.sessions.write();
|
let mut connections = self.sessions.write();
|
||||||
if let Some(connection) = connections.get(stream).cloned() {
|
if let Some(connection) = connections.get(stream).cloned() {
|
||||||
let c = connection.lock();
|
let c = connection.lock();
|
||||||
@ -1406,7 +1406,7 @@ impl IoHandler<NetworkIoMessage> for Host {
|
|||||||
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
event_loop: &mut EventLoop<IoManager<NetworkIoMessage>>,
|
||||||
) {
|
) {
|
||||||
match stream {
|
match stream {
|
||||||
FIRST_SESSION...LAST_SESSION => {
|
FIRST_SESSION..=LAST_SESSION => {
|
||||||
let connection = { self.sessions.read().get(stream).cloned() };
|
let connection = { self.sessions.read().get(stream).cloned() };
|
||||||
if let Some(connection) = connection {
|
if let Some(connection) = connection {
|
||||||
connection
|
connection
|
||||||
|
@ -453,7 +453,7 @@ impl Session {
|
|||||||
}
|
}
|
||||||
PACKET_GET_PEERS => Ok(SessionData::None), //TODO;
|
PACKET_GET_PEERS => Ok(SessionData::None), //TODO;
|
||||||
PACKET_PEERS => Ok(SessionData::None),
|
PACKET_PEERS => Ok(SessionData::None),
|
||||||
PACKET_USER...PACKET_LAST => {
|
PACKET_USER..=PACKET_LAST => {
|
||||||
let mut i = 0usize;
|
let mut i = 0usize;
|
||||||
while packet_id
|
while packet_id
|
||||||
>= self.info.capabilities[i].id_offset + self.info.capabilities[i].packet_count
|
>= self.info.capabilities[i].id_offset + self.info.capabilities[i].packet_count
|
||||||
|
@ -66,9 +66,9 @@ fn num_padding_length_bytes(padding_len: usize) -> Option<usize> {
|
|||||||
let bits = 64 - (padding_len as u64).leading_zeros();
|
let bits = 64 - (padding_len as u64).leading_zeros();
|
||||||
match bits {
|
match bits {
|
||||||
0 => Some(0),
|
0 => Some(0),
|
||||||
0...8 => Some(1),
|
1..=8 => Some(1),
|
||||||
0...16 => Some(2),
|
9..=16 => Some(2),
|
||||||
0...24 => Some(3),
|
17..=24 => Some(3),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user