Commit 7e5e68ae authored by Éloïs's avatar Éloïs

[style] fix clippy warnings

parent 92a79fa5
......@@ -641,22 +641,24 @@ impl BlockchainModule {
}
}
DursMsg::Event {
ref event_content,
..
ref event_content, ..
} => match *event_content {
DursEvent::NetworkEvent(ref network_event_box) => match *network_event_box.deref() {
NetworkEvent::ReceiveDocuments(ref network_docs) => {
let new_current_blockstamp = self.receive_network_documents(
network_docs,
&current_blockstamp,
&mut wot_index,
&wot_db,
);
current_blockstamp = new_current_blockstamp;
DursEvent::NetworkEvent(ref network_event_box) => {
match *network_event_box.deref() {
NetworkEvent::ReceiveDocuments(ref network_docs) => {
let new_current_blockstamp = self
.receive_network_documents(
network_docs,
&current_blockstamp,
&mut wot_index,
&wot_db,
);
current_blockstamp = new_current_blockstamp;
}
NetworkEvent::ReceiveHeads(_) => {}
_ => {}
}
NetworkEvent::ReceiveHeads(_) => {}
_ => {}
},
}
DursEvent::ReceiveValidDocsFromClient(ref docs) => {
self.receive_documents(docs);
}
......@@ -666,7 +668,10 @@ impl BlockchainModule {
ref req_id,
ref res_content,
..
} => if let DursResContent::NetworkResponse(ref network_response) = *res_content {
} => {
if let DursResContent::NetworkResponse(ref network_response) =
*res_content
{
debug!("BlockchainModule : receive NetworkResponse() !");
if let Some(request) = pending_network_requests.remove(req_id) {
match request {
......@@ -733,6 +738,7 @@ impl BlockchainModule {
}
}
}
}
DursMsg::Stop => break,
_ => {} // Others DursMsg variants
}
......
......@@ -535,8 +535,7 @@ impl DuniterModule<DuRsConf, DursMsg> for TuiModule {
break;
}
DursMsg::Event {
ref event_content,
..
ref event_content, ..
} => match *event_content {
DursEvent::BlockchainEvent(ref dal_event) => match *dal_event {
BlockchainEvent::StackUpValidBlock(ref _block, ref _blockstamp) => {
......@@ -544,42 +543,46 @@ impl DuniterModule<DuRsConf, DursMsg> for TuiModule {
BlockchainEvent::RevertBlocks(ref _blocks) => {}
_ => {}
},
DursEvent::NetworkEvent(ref network_event_box) => match *network_event_box.deref() {
NetworkEvent::ConnectionStateChange(
ref node_full_id,
ref status,
ref uid,
ref url,
) => {
if let Some(conn) = tui.connections_status.get(&node_full_id) {
if *status == 12 && (*conn).status != 12 {
tui.established_conns_count += 1;
} else if *status != 12
&& (*conn).status == 12
&& tui.established_conns_count > 0
DursEvent::NetworkEvent(ref network_event_box) => {
match *network_event_box.deref() {
NetworkEvent::ConnectionStateChange(
ref node_full_id,
ref status,
ref uid,
ref url,
) => {
if let Some(conn) =
tui.connections_status.get(&node_full_id)
{
tui.established_conns_count -= 1;
}
};
tui.connections_status.insert(
*node_full_id,
Connection {
status: *status,
url: url.clone(),
uid: uid.clone(),
},
);
}
NetworkEvent::ReceiveHeads(ref heads) => {
heads
.iter()
.map(|h| {
tui.heads_cache.insert(h.node_full_id(), h.clone())
})
.for_each(drop);
if *status == 12 && (*conn).status != 12 {
tui.established_conns_count += 1;
} else if *status != 12
&& (*conn).status == 12
&& tui.established_conns_count > 0
{
tui.established_conns_count -= 1;
}
};
tui.connections_status.insert(
*node_full_id,
Connection {
status: *status,
url: url.clone(),
uid: uid.clone(),
},
);
}
NetworkEvent::ReceiveHeads(ref heads) => {
heads
.iter()
.map(|h| {
tui.heads_cache.insert(h.node_full_id(), h.clone())
})
.for_each(drop);
}
_ => {}
}
_ => {}
},
}
_ => {}
},
_ => {}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment