Skip to content

Commit 0f57148

Browse files
Seulgi Kimmergify[bot]
authored andcommitted
... range patterns are deprecated
1 parent bd68535 commit 0f57148

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

network/src/p2p/handler.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ impl IoHandler<Message> for Handler {
363363
const CHECK_BOOTSTRAP_INTERVAL: Duration = Duration::from_secs(15);
364364
io.register_timer_once(CONNECT_TO_BOOTSTRAP, CHECK_BOOTSTRAP_INTERVAL);
365365
}
366-
FIRST_WAIT_SYNC...LAST_WAIT_SYNC => {
366+
FIRST_WAIT_SYNC..=LAST_WAIT_SYNC => {
367367
cwarn!(NETWORK, "No sync message from {}", timer);
368368
io.deregister_stream(wait_sync_stream(timer));
369369
}
370-
FIRST_WAIT_ACK...LAST_WAIT_ACK => {
370+
FIRST_WAIT_ACK..=LAST_WAIT_ACK => {
371371
cwarn!(NETWORK, "No ack message from {}", timer);
372372
io.deregister_stream(wait_ack_stream(timer));
373373
}
374-
FIRST_TRY_SYNC...LAST_TRY_SYNC => {
374+
FIRST_TRY_SYNC..=LAST_TRY_SYNC => {
375375
let stream = retry_sync_stream(timer);
376376
let mut outgoing_connections = self.outgoing_connections.write();
377377
if let Some(con) = outgoing_connections.get_mut(&stream) {
@@ -430,7 +430,7 @@ impl IoHandler<Message> for Handler {
430430
let stream =
431431
*self.remote_node_ids_reverse.read().get(&node_id).ok_or_else(|| Error::InvalidNode(node_id))?;
432432
let (network_message_size, peer_addr) = match stream {
433-
FIRST_OUTBOUND...LAST_OUTBOUND => {
433+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
434434
let mut outbound_connections = self.outbound_connections.write();
435435
if let Some(con) = outbound_connections.get_mut(&stream) {
436436
let _f = finally(|| {
@@ -445,7 +445,7 @@ impl IoHandler<Message> for Handler {
445445
return Err(format!("{} is an invalid stream", stream).into())
446446
}
447447
}
448-
FIRST_INBOUND...LAST_INBOUND => {
448+
FIRST_INBOUND..=LAST_INBOUND => {
449449
let mut inbound_connections = self.inbound_connections.write();
450450
if let Some(con) = inbound_connections.get_mut(&stream) {
451451
let _f = finally(|| {
@@ -577,19 +577,19 @@ impl IoHandler<Message> for Handler {
577577

578578
fn stream_hup(&self, io: &IoContext<Message>, stream: StreamToken) -> IoHandlerResult<()> {
579579
match stream {
580-
FIRST_INBOUND...LAST_INBOUND => {
580+
FIRST_INBOUND..=LAST_INBOUND => {
581581
cinfo!(NETWORK, "Hang-up inbound stream({})", stream);
582582
io.deregister_stream(stream);
583583
}
584-
FIRST_OUTBOUND...LAST_OUTBOUND => {
584+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
585585
cinfo!(NETWORK, "Hang-up outbound stream({})", stream);
586586
io.deregister_stream(stream);
587587
}
588-
FIRST_INCOMING...LAST_INCOMING => {
588+
FIRST_INCOMING..=LAST_INCOMING => {
589589
cinfo!(NETWORK, "Hang-up incoming stream({})", stream);
590590
io.deregister_stream(stream);
591591
}
592-
FIRST_OUTGOING...LAST_OUTGOING => {
592+
FIRST_OUTGOING..=LAST_OUTGOING => {
593593
cinfo!(NETWORK, "Hang-up outgoing stream({})", stream);
594594
io.deregister_stream(stream);
595595
}
@@ -647,7 +647,7 @@ impl IoHandler<Message> for Handler {
647647
io.register_timer_once(wait_sync_timer(token), WAIT_SYNC);
648648
}
649649
}
650-
FIRST_INBOUND...LAST_INBOUND => {
650+
FIRST_INBOUND..=LAST_INBOUND => {
651651
let mut inbound_connections = self.inbound_connections.write();
652652
if let Some(con) = inbound_connections.get_mut(&stream_token) {
653653
let should_update = AtomicBool::new(true);
@@ -716,7 +716,7 @@ impl IoHandler<Message> for Handler {
716716
cdebug!(NETWORK, "Invalid inbound token({}) on read", stream_token);
717717
}
718718
}
719-
FIRST_OUTBOUND...LAST_OUTBOUND => {
719+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
720720
let mut outbound_connections = self.outbound_connections.write();
721721
if let Some(con) = outbound_connections.get_mut(&stream_token) {
722722
let should_update = AtomicBool::new(true);
@@ -761,7 +761,7 @@ impl IoHandler<Message> for Handler {
761761
cdebug!(NETWORK, "Invalid outbound token({}) on read", stream_token);
762762
}
763763
}
764-
FIRST_INCOMING...LAST_INCOMING => {
764+
FIRST_INCOMING..=LAST_INCOMING => {
765765
let mut incoming_connections = self.incoming_connections.write();
766766
if let Some(con) = incoming_connections.get_mut(&stream_token) {
767767
let should_update = AtomicBool::new(true);
@@ -855,7 +855,7 @@ impl IoHandler<Message> for Handler {
855855
cdebug!(NETWORK, "Invalid incoming token({}) on read", stream_token);
856856
}
857857
}
858-
FIRST_OUTGOING...LAST_OUTGOING => {
858+
FIRST_OUTGOING..=LAST_OUTGOING => {
859859
let mut outgoing_connections = self.outgoing_connections.write();
860860
if let Some(con) = outgoing_connections.get_mut(&stream_token) {
861861
let should_update = AtomicBool::new(true);
@@ -904,28 +904,28 @@ impl IoHandler<Message> for Handler {
904904

905905
fn stream_writable(&self, _io: &IoContext<Message>, stream: StreamToken) -> IoHandlerResult<()> {
906906
match stream {
907-
FIRST_INBOUND...LAST_INBOUND => {
907+
FIRST_INBOUND..=LAST_INBOUND => {
908908
if let Some(con) = self.inbound_connections.write().get_mut(&stream) {
909909
con.flush()?;
910910
} else {
911911
cdebug!(NETWORK, "Invalid inbound token({}) on write", stream);
912912
}
913913
}
914-
FIRST_OUTBOUND...LAST_OUTBOUND => {
914+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
915915
if let Some(con) = self.outbound_connections.write().get_mut(&stream) {
916916
con.flush()?;
917917
} else {
918918
cdebug!(NETWORK, "Invalid outbound token({}) on write", stream);
919919
}
920920
}
921-
FIRST_INCOMING...LAST_INCOMING => {
921+
FIRST_INCOMING..=LAST_INCOMING => {
922922
if let Some(con) = self.incoming_connections.write().get_mut(&stream) {
923923
con.flush()?;
924924
} else {
925925
cdebug!(NETWORK, "Invalid incoming token({}) on write", stream);
926926
}
927927
}
928-
FIRST_OUTGOING...LAST_OUTGOING => {
928+
FIRST_OUTGOING..=LAST_OUTGOING => {
929929
if let Some(con) = self.outgoing_connections.write().get_mut(&stream) {
930930
con.flush()?;
931931
} else {
@@ -948,31 +948,31 @@ impl IoHandler<Message> for Handler {
948948
event_loop.register(&self.listener, reg, Ready::readable(), PollOpt::edge())?;
949949
ctrace!(NETWORK, "TCP connection starts for {}", self.socket_address);
950950
}
951-
FIRST_INBOUND...LAST_INBOUND => {
951+
FIRST_INBOUND..=LAST_INBOUND => {
952952
if let Some(con) = self.inbound_connections.read().get(&stream) {
953953
con.register(reg, event_loop)?;
954954
ctrace!(NETWORK, "Inbound connect({}) registered", stream);
955955
} else {
956956
cdebug!(NETWORK, "Invalid inbound token({}) on register", stream);
957957
}
958958
}
959-
FIRST_OUTBOUND...LAST_OUTBOUND => {
959+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
960960
if let Some(con) = self.outbound_connections.read().get(&stream) {
961961
con.register(reg, event_loop)?;
962962
ctrace!(NETWORK, "Outbound connect({}) registered", stream);
963963
} else {
964964
cdebug!(NETWORK, "Invalid outbound token({}) on register", stream);
965965
}
966966
}
967-
FIRST_INCOMING...LAST_INCOMING => {
967+
FIRST_INCOMING..=LAST_INCOMING => {
968968
if let Some(con) = self.incoming_connections.read().get(&stream) {
969969
con.register(reg, event_loop)?;
970970
ctrace!(NETWORK, "Incoming connect({}) registered", stream);
971971
} else {
972972
cdebug!(NETWORK, "Invalid incoming token({}) on register", stream);
973973
}
974974
}
975-
FIRST_OUTGOING...LAST_OUTGOING => {
975+
FIRST_OUTGOING..=LAST_OUTGOING => {
976976
if let Some(con) = self.outgoing_connections.read().get(&stream) {
977977
con.register(reg, event_loop)?;
978978
ctrace!(NETWORK, "Outgoing connect({}) registered", stream);
@@ -1000,31 +1000,31 @@ impl IoHandler<Message> for Handler {
10001000
ACCEPT => {
10011001
event_loop.reregister(&self.listener, reg, Ready::readable(), PollOpt::edge())?;
10021002
}
1003-
FIRST_INBOUND...LAST_INBOUND => {
1003+
FIRST_INBOUND..=LAST_INBOUND => {
10041004
if let Some(con) = self.inbound_connections.read().get(&stream) {
10051005
con.reregister(reg, event_loop)?;
10061006
ctrace!(NETWORK, "Inbound connect({}) updated", stream);
10071007
} else {
10081008
cdebug!(NETWORK, "Invalid inbound token({}) on update", stream);
10091009
}
10101010
}
1011-
FIRST_OUTBOUND...LAST_OUTBOUND => {
1011+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
10121012
if let Some(con) = self.outbound_connections.read().get(&stream) {
10131013
con.reregister(reg, event_loop)?;
10141014
ctrace!(NETWORK, "Outbound connect({}) updated", stream);
10151015
} else {
10161016
cdebug!(NETWORK, "Invalid outbound token({}) on update", stream);
10171017
}
10181018
}
1019-
FIRST_INCOMING...LAST_INCOMING => {
1019+
FIRST_INCOMING..=LAST_INCOMING => {
10201020
if let Some(con) = self.incoming_connections.read().get(&stream) {
10211021
con.reregister(reg, event_loop)?;
10221022
ctrace!(NETWORK, "Incoming connect({}) updated", stream);
10231023
} else {
10241024
cdebug!(NETWORK, "Invalid incoming token({}) on update", stream);
10251025
}
10261026
}
1027-
FIRST_OUTGOING...LAST_OUTGOING => {
1027+
FIRST_OUTGOING..=LAST_OUTGOING => {
10281028
if let Some(con) = self.outgoing_connections.read().get(&stream) {
10291029
con.reregister(reg, event_loop)?;
10301030
ctrace!(NETWORK, "Outgoing connect({}) updated", stream);
@@ -1044,7 +1044,7 @@ impl IoHandler<Message> for Handler {
10441044
) -> IoHandlerResult<()> {
10451045
self.channel.send(Message::StartConnect)?;
10461046
match stream {
1047-
FIRST_INBOUND...LAST_INBOUND => {
1047+
FIRST_INBOUND..=LAST_INBOUND => {
10481048
let mut inbound_connections = self.inbound_connections.write();
10491049
if let Some(con) = inbound_connections.remove(&stream) {
10501050
if let Some(node_id) = self.remote_node_ids.write().remove(&stream) {
@@ -1061,7 +1061,7 @@ impl IoHandler<Message> for Handler {
10611061
cdebug!(NETWORK, "Invalid inbound token({}) on deregister", stream);
10621062
}
10631063
}
1064-
FIRST_OUTBOUND...LAST_OUTBOUND => {
1064+
FIRST_OUTBOUND..=LAST_OUTBOUND => {
10651065
let mut outbound_connections = self.outbound_connections.write();
10661066
if let Some(con) = outbound_connections.remove(&stream) {
10671067
if let Some(node_id) = self.remote_node_ids.write().remove(&stream) {
@@ -1078,7 +1078,7 @@ impl IoHandler<Message> for Handler {
10781078
cdebug!(NETWORK, "Invalid outbound token({}) on deregister", stream);
10791079
}
10801080
}
1081-
FIRST_INCOMING...LAST_INCOMING => {
1081+
FIRST_INCOMING..=LAST_INCOMING => {
10821082
let mut incoming_connections = self.incoming_connections.write();
10831083
if let Some(con) = incoming_connections.remove(&stream) {
10841084
con.deregister(event_loop)?;
@@ -1107,7 +1107,7 @@ impl IoHandler<Message> for Handler {
11071107
cdebug!(NETWORK, "Invalid incoming token({}) on deregister", stream);
11081108
}
11091109
}
1110-
FIRST_OUTGOING...LAST_OUTGOING => {
1110+
FIRST_OUTGOING..=LAST_OUTGOING => {
11111111
let mut outgoing_connections = self.outgoing_connections.write();
11121112
if let Some(con) = outgoing_connections.remove(&stream) {
11131113
con.deregister(event_loop)?;

sync/src/block/extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl NetworkExtension<Event> for Extension {
311311
}
312312
}
313313
}
314-
SYNC_EXPIRE_TOKEN_BEGIN...SYNC_EXPIRE_TOKEN_END => {
314+
SYNC_EXPIRE_TOKEN_BEGIN..=SYNC_EXPIRE_TOKEN_END => {
315315
self.check_sync_variable();
316316
let (id, request_id) = {
317317
let token_info = match self.tokens_info.get_mut(&token) {

util/rlp/src/stream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl<'a> BasicEncoder<'a> {
352352
fn insert_list_payload(&mut self, len: usize, pos: usize) {
353353
// 1 byte was already reserved for payload earlier
354354
match len {
355-
0...55 => {
355+
0..=55 => {
356356
self.buffer[pos - 1] = 0xc0u8 + len as u8;
357357
}
358358
_ => {
@@ -370,7 +370,7 @@ impl<'a> BasicEncoder<'a> {
370370
// byte is its own encoding if < 0x80
371371
1 if value[0] < 0x80 => self.buffer.push(value[0]),
372372
// (prefix + length), followed by the string
373-
len @ 1...55 => {
373+
len @ 1..=55 => {
374374
self.buffer.push(0x80u8 + len as u8);
375375
self.buffer.append_slice(value);
376376
}

util/rlp/src/untrusted_rlp.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ impl PayloadInfo {
8989
expected: 1,
9090
got: 0,
9191
}),
92-
Some(0...0x7f) => Ok(PayloadInfo::new(0, 1)),
93-
Some(l @ 0x80...0xb7) => Ok(PayloadInfo::new(1, l as usize - 0x80)),
94-
Some(l @ 0xb8...0xbf) => {
92+
Some(0..=0x7f) => Ok(PayloadInfo::new(0, 1)),
93+
Some(l @ 0x80..=0xb7) => Ok(PayloadInfo::new(1, l as usize - 0x80)),
94+
Some(l @ 0xb8..=0xbf) => {
9595
let len_of_len = l as usize - 0xb7;
9696
calculate_payload_info(header_bytes, len_of_len)
9797
}
98-
Some(l @ 0xc0...0xf7) => Ok(PayloadInfo::new(1, l as usize - 0xc0)),
99-
Some(l @ 0xf8...0xff) => {
98+
Some(l @ 0xc0..=0xf7) => Ok(PayloadInfo::new(1, l as usize - 0xc0)),
99+
Some(l @ 0xf8..=0xff) => {
100100
let len_of_len = l as usize - 0xf7;
101101
calculate_payload_info(header_bytes, len_of_len)
102102
}
@@ -263,9 +263,9 @@ where
263263
}
264264

265265
match self.bytes[0] {
266-
0...0x80 => true,
267-
0x81...0xb7 => self.bytes[1] != 0,
268-
b @ 0xb8...0xbf => self.bytes[1 + b as usize - 0xb7] != 0,
266+
0..=0x80 => true,
267+
0x81..=0xb7 => self.bytes[1] != 0,
268+
b @ 0xb8..=0xbf => self.bytes[1 + b as usize - 0xb7] != 0,
269269
_ => false,
270270
}
271271
}
@@ -402,9 +402,9 @@ impl<'a> BasicDecoder<'a> {
402402
got: 0,
403403
}),
404404
// Single byte value.
405-
Some(l @ 0...0x7f) => Ok(f(&[l])?),
405+
Some(l @ 0..=0x7f) => Ok(f(&[l])?),
406406
// 0-55 bytes
407-
Some(l @ 0x80...0xb7) => {
407+
Some(l @ 0x80..=0xb7) => {
408408
let last_index_of = 1 + l as usize - 0x80;
409409
if bytes.len() < last_index_of {
410410
return Err(DecoderError::RlpInconsistentLengthAndData {
@@ -419,7 +419,7 @@ impl<'a> BasicDecoder<'a> {
419419
Ok(f(d)?)
420420
}
421421
// Longer than 55 bytes.
422-
Some(l @ 0xb8...0xbf) => {
422+
Some(l @ 0xb8..=0xbf) => {
423423
let len_of_len = l as usize - 0xb7;
424424
let begin_of_value = 1 as usize + len_of_len;
425425
if bytes.len() < begin_of_value {

0 commit comments

Comments
 (0)