Fix clippy warnings

pull/2/head
rishflab 4 years ago
parent 697e1195cd
commit 6b7193b974

@ -69,13 +69,14 @@ pub async fn next_state<
let state6 = state5.receive(message3); let state6 = state5.receive(message3);
tracing::info!("alice has received bob message 3"); tracing::info!("alice has received bob message 3");
tracing::info!("alice is redeeming btc"); tracing::info!("alice is redeeming btc");
state6.redeem_btc(bitcoin_wallet).await.unwrap(); state6.redeem_btc(bitcoin_wallet).await?;
Ok(state6.into()) Ok(state6.into())
} }
State::State6(state6) => Ok(state6.into()), State::State6(state6) => Ok(state6.into()),
} }
} }
#[allow(clippy::large_enum_variant)]
#[derive(Debug)] #[derive(Debug)]
pub enum State { pub enum State {
State0(State0), State0(State0),
@ -89,24 +90,15 @@ pub enum State {
// TODO: use macro or generics // TODO: use macro or generics
pub fn is_state4(state: &State) -> bool { pub fn is_state4(state: &State) -> bool {
match state { matches!(state, State::State4 { .. })
State::State4 { .. } => true,
_ => false,
}
} }
// TODO: use macro or generics // TODO: use macro or generics
pub fn is_state5(state: &State) -> bool { pub fn is_state5(state: &State) -> bool {
match state { matches!(state, State::State5 { .. })
State::State5 { .. } => true,
_ => false,
}
} }
// TODO: use macro or generics // TODO: use macro or generics
pub fn is_state6(state: &State) -> bool { pub fn is_state6(state: &State) -> bool {
match state { matches!(state, State::State6 { .. })
State::State6 { .. } => true,
_ => false,
}
} }
macro_rules! impl_try_from_parent_state { macro_rules! impl_try_from_parent_state {

@ -126,18 +126,12 @@ impl_from_child_state!(State5);
// TODO: use macro or generics // TODO: use macro or generics
pub fn is_state5(state: &State) -> bool { pub fn is_state5(state: &State) -> bool {
match state { matches!(state, State::State5 { .. })
State::State5 { .. } => true,
_ => false,
}
} }
// TODO: use macro or generics // TODO: use macro or generics
pub fn is_state3(state: &State) -> bool { pub fn is_state3(state: &State) -> bool {
match state { matches!(state, State::State3 { .. })
State::State3 { .. } => true,
_ => false,
}
} }
#[derive(Debug)] #[derive(Debug)]

@ -124,7 +124,7 @@ pub async fn init_test<'a>(
xmr_amount, xmr_amount,
RELATIVE_REFUND_TIMELOCK, RELATIVE_REFUND_TIMELOCK,
RELATIVE_PUNISH_TIMELOCK, RELATIVE_PUNISH_TIMELOCK,
refund_address.clone(), refund_address,
); );
let initial_balances = InitialBalances { let initial_balances = InitialBalances {
alice_xmr: alice_initial_xmr_balance, alice_xmr: alice_initial_xmr_balance,

Loading…
Cancel
Save