Skip to content

Commit cb4b05a

Browse files
committed
rust fmt & clippy fixes
1 parent 1c825a8 commit cb4b05a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

validator_worker/src/producer.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use std::error::Error;
22

33
use chrono::{TimeZone, Utc};
44

5-
use primitives::{BalancesMap, Channel};
65
use primitives::adapter::Adapter;
76
use primitives::validator::{Accounting, MessageTypes};
7+
use primitives::{BalancesMap, Channel};
88

99
use crate::core::events::merge_aggrs;
1010
use crate::sentry_interface::SentryApi;
@@ -14,20 +14,22 @@ pub type Result = std::result::Result<(BalancesMap, Option<MessageTypes>), Box<d
1414
pub async fn tick<A: Adapter + 'static>(iface: &SentryApi<A>) -> Result {
1515
let validator_msg_resp = await!(iface.get_our_latest_msg("Accounting".to_owned()))?;
1616

17-
let accounting = validator_msg_resp.msg.get(0).and_then(|accounting| match accounting {
18-
MessageTypes::Accounting(accounting) => Some(accounting.to_owned()),
19-
_ => None,
20-
}).unwrap_or_else(|| {
21-
Accounting {
17+
let accounting = validator_msg_resp
18+
.msg
19+
.get(0)
20+
.and_then(|accounting| match accounting {
21+
MessageTypes::Accounting(accounting) => Some(accounting.to_owned()),
22+
_ => None,
23+
})
24+
.unwrap_or_else(|| Accounting {
2225
last_event_aggregate: Utc.timestamp(0, 0),
2326
balances_before_fees: Default::default(),
2427
balances: Default::default(),
25-
}
26-
});
28+
});
2729

2830
let aggrs = await!(iface.get_event_aggregates(accounting.last_event_aggregate))?;
2931

30-
if aggrs.events.len() > 0 {
32+
if !aggrs.events.is_empty() {
3133
// TODO: Log the merge
3234
let (balances, new_accounting) = merge_aggrs(&accounting, &aggrs.events, &iface.channel)?;
3335

0 commit comments

Comments
 (0)