mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 00:01:03 +00:00
simplify some pattern matches to appease 1.68 clippy (#13833)
This commit is contained in:
@@ -424,9 +424,9 @@ pub trait ChainSync<Block: BlockT>: Send {
|
||||
///
|
||||
/// If [`PollBlockAnnounceValidation::ImportHeader`] is returned, then the caller MUST try to
|
||||
/// import passed header (call `on_block_data`). The network request isn't sent in this case.
|
||||
fn poll_block_announce_validation<'a>(
|
||||
fn poll_block_announce_validation(
|
||||
&mut self,
|
||||
cx: &mut std::task::Context<'a>,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
) -> Poll<PollBlockAnnounceValidation<Block::Header>>;
|
||||
|
||||
/// Call when a peer has disconnected.
|
||||
|
||||
@@ -2628,8 +2628,7 @@ mod tests {
|
||||
conn,
|
||||
NotifsHandlerOut::OpenDesiredByRemote { protocol_index: 0 },
|
||||
);
|
||||
if let Some(&PeerState::Incoming { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Incoming { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections.len(), 1);
|
||||
assert_eq!(connections[0], (conn, ConnectionState::OpenDesiredByRemote));
|
||||
} else {
|
||||
@@ -2647,8 +2646,7 @@ mod tests {
|
||||
},
|
||||
));
|
||||
|
||||
if let Some(&PeerState::Incoming { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Incoming { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections.len(), 2);
|
||||
assert_eq!(connections[0], (conn, ConnectionState::OpenDesiredByRemote));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
@@ -2797,8 +2795,7 @@ mod tests {
|
||||
},
|
||||
));
|
||||
|
||||
if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections.len(), 1);
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Closed));
|
||||
} else {
|
||||
@@ -2884,8 +2881,7 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Closed));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
} else {
|
||||
@@ -2900,8 +2896,7 @@ mod tests {
|
||||
NotifsHandlerOut::OpenDesiredByRemote { protocol_index: 0 },
|
||||
);
|
||||
|
||||
if let Some(&PeerState::Enabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Enabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Opening));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Opening));
|
||||
} else {
|
||||
@@ -3297,8 +3292,7 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Closed));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
} else {
|
||||
@@ -3356,8 +3350,7 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Closed));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
} else {
|
||||
@@ -3413,8 +3406,7 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(&PeerState::Disabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Disabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Closed));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
} else {
|
||||
@@ -3424,8 +3416,7 @@ mod tests {
|
||||
// open substreams on both active connections
|
||||
notif.peerset_report_connect(peer, set_id);
|
||||
|
||||
if let Some(&PeerState::Enabled { ref connections, .. }) = notif.peers.get(&(peer, set_id))
|
||||
{
|
||||
if let Some(PeerState::Enabled { connections, .. }) = notif.peers.get(&(peer, set_id)) {
|
||||
assert_eq!(connections[0], (conn1, ConnectionState::Opening));
|
||||
assert_eq!(connections[1], (conn2, ConnectionState::Closed));
|
||||
} else {
|
||||
|
||||
@@ -89,7 +89,7 @@ impl<B: BlockT> BlockCollection<B> {
|
||||
Some(&BlockRangeState::Downloading { .. }) => {
|
||||
trace!(target: "sync", "Inserting block data still marked as being downloaded: {}", start);
|
||||
},
|
||||
Some(&BlockRangeState::Complete(ref existing)) if existing.len() >= blocks.len() => {
|
||||
Some(BlockRangeState::Complete(existing)) if existing.len() >= blocks.len() => {
|
||||
trace!(target: "sync", "Ignored block data already downloaded: {}", start);
|
||||
return
|
||||
},
|
||||
|
||||
@@ -473,7 +473,7 @@ where
|
||||
|
||||
let (hashes, to_send): (Vec<_>, Vec<_>) = transactions
|
||||
.iter()
|
||||
.filter(|&(ref hash, _)| peer.known_transactions.insert(hash.clone()))
|
||||
.filter(|(hash, _)| peer.known_transactions.insert(hash.clone()))
|
||||
.cloned()
|
||||
.unzip();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user