Commit 80267492 authored by Éloïs's avatar Éloïs

[style] fix clippy warnings

parent 7ed51b27
......@@ -254,7 +254,7 @@ impl<'a, 'b: 'a> DuniterCore<'b, 'a, DuRsConf> {
init_logger(profile.as_str(), self.soft_meta_datas.soft_name, &cli_args);
// Print panic! in logs
//log_panics::init();
log_panics::init();
// Load global conf
let (conf, keypairs) = duniter_conf::load_conf(profile.as_str());
......
......@@ -26,7 +26,7 @@ pub enum DursEvent {
/// Blockchain event
BlockchainEvent(BlockchainEvent),
/// Network event
NetworkEvent(NetworkEvent),
NetworkEvent(Box<NetworkEvent>),
/// Client API event
ReceiveValidDocsFromClient(Vec<DUBPDocument>),
}
......
......@@ -590,9 +590,8 @@ impl BlockchainModule {
match *durs_message {
DursMsg::Request {
req_from,
req_to: _,
req_id,
ref req_content,
..
} => {
if let DursReqContent::BlockchainRequest(ref blockchain_req) =
req_content
......@@ -642,10 +641,10 @@ impl BlockchainModule {
}
}
DursMsg::Event {
event_type: _,
ref event_content,
..
} => match *event_content {
DursEvent::NetworkEvent(ref network_event) => match *network_event {
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,
......@@ -664,12 +663,10 @@ impl BlockchainModule {
_ => {} // Others modules events
},
DursMsg::Response {
res_from: _,
res_to: _,
ref req_id,
ref res_content,
} => match *res_content {
DursResContent::NetworkResponse(ref network_response) => {
..
} => 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 {
......@@ -736,8 +733,6 @@ impl BlockchainModule {
}
}
}
_ => {} // Others DursResContent variants
},
DursMsg::Stop => break,
_ => {} // Others DursMsg variants
}
......
......@@ -535,8 +535,8 @@ impl DuniterModule<DuRsConf, DursMsg> for TuiModule {
break;
}
DursMsg::Event {
event_type: _,
ref event_content,
..
} => match *event_content {
DursEvent::BlockchainEvent(ref dal_event) => match *dal_event {
BlockchainEvent::StackUpValidBlock(ref _block, ref _blockstamp) => {
......@@ -544,7 +544,7 @@ impl DuniterModule<DuRsConf, DursMsg> for TuiModule {
BlockchainEvent::RevertBlocks(ref _blocks) => {}
_ => {}
},
DursEvent::NetworkEvent(ref network_event) => match *network_event {
DursEvent::NetworkEvent(ref network_event_box) => match *network_event_box.deref() {
NetworkEvent::ConnectionStateChange(
ref node_full_id,
ref status,
......
cyclomatic-complexity-threshold = 75
\ No newline at end of file
cyclomatic-complexity-threshold = 76
\ No newline at end of file
......@@ -113,7 +113,7 @@ impl WS2PModuleDatas {
self.router_sender
.send(RouterThreadMessage::ModuleMessage(DursMsg::Event {
event_type: module_event,
event_content: DursEvent::NetworkEvent(event.clone()),
event_content: DursEvent::NetworkEvent(Box::new(event.clone())),
}))
.expect("Fail to send network event to router !");
}
......
......@@ -412,12 +412,10 @@ impl DuniterModule<DuRsConf, DursMsg> for WS2PModule {
match *durs_mesage.deref() {
DursMsg::Stop => break,
DursMsg::Request {
req_from: _,
req_to: _,
req_id: _,
ref req_content,
} => match *req_content {
DursReqContent::OldNetworkRequest(ref request) => match *request {
..
} => if let DursReqContent::OldNetworkRequest(ref old_net_request) = *req_content {
match *old_net_request {
OldNetworkRequest::GetBlocks(
ref req_id,
ref receiver,
......@@ -473,14 +471,13 @@ impl DuniterModule<DuRsConf, DursMsg> for WS2PModule {
}
OldNetworkRequest::GetEndpoints(ref _request) => {}
_ => {}
},
_ => {} // Others DursReqContent variants
}
},
DursMsg::Event {
event_type: _,
ref event_content,
} => match *event_content {
DursEvent::BlockchainEvent(ref dal_event) => match *dal_event {
..
} => if let DursEvent::BlockchainEvent(ref bc_event) = *event_content {
match *bc_event {
BlockchainEvent::StackUpValidBlock(
ref _block,
ref blockstamp,
......@@ -527,16 +524,13 @@ impl DuniterModule<DuRsConf, DursMsg> for WS2PModule {
}
BlockchainEvent::RevertBlocks(ref _blocks) => {}
_ => {}
},
_ => {} // Others DursEvent variants
}
},
DursMsg::Response {
res_from: _,
res_to: _,
req_id: _,
ref res_content,
} => match *res_content {
DursResContent::BlockchainResponse(ref bc_res) => match *bc_res
..
} => if let DursResContent::BlockchainResponse(ref bc_res) = *res_content {
match *bc_res
.deref()
{
BlockchainResponse::CurrentBlock(
......@@ -605,8 +599,7 @@ impl DuniterModule<DuRsConf, DursMsg> for WS2PModule {
}
}
_ => {} // Others BlockchainResponse variants
},
_ => {} // Others DursResContent variants
}
},
_ => {} // Others DursMsg variants
}
......
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