diff --git a/xmr-btc/src/alice.rs b/xmr-btc/src/alice.rs index d6ecbc67..6cdf75d8 100644 --- a/xmr-btc/src/alice.rs +++ b/xmr-btc/src/alice.rs @@ -69,13 +69,14 @@ pub async fn next_state< let state6 = state5.receive(message3); tracing::info!("alice has received bob message 3"); tracing::info!("alice is redeeming btc"); - state6.redeem_btc(bitcoin_wallet).await.unwrap(); + state6.redeem_btc(bitcoin_wallet).await?; Ok(state6.into()) } State::State6(state6) => Ok(state6.into()), } } +#[allow(clippy::large_enum_variant)] #[derive(Debug)] pub enum State { State0(State0), @@ -89,24 +90,15 @@ pub enum State { // TODO: use macro or generics pub fn is_state4(state: &State) -> bool { - match state { - State::State4 { .. } => true, - _ => false, - } + matches!(state, State::State4 { .. }) } // TODO: use macro or generics pub fn is_state5(state: &State) -> bool { - match state { - State::State5 { .. } => true, - _ => false, - } + matches!(state, State::State5 { .. }) } // TODO: use macro or generics pub fn is_state6(state: &State) -> bool { - match state { - State::State6 { .. } => true, - _ => false, - } + matches!(state, State::State6 { .. }) } macro_rules! impl_try_from_parent_state { diff --git a/xmr-btc/src/bob.rs b/xmr-btc/src/bob.rs index 44a8a407..f1b28905 100644 --- a/xmr-btc/src/bob.rs +++ b/xmr-btc/src/bob.rs @@ -126,18 +126,12 @@ impl_from_child_state!(State5); // TODO: use macro or generics pub fn is_state5(state: &State) -> bool { - match state { - State::State5 { .. } => true, - _ => false, - } + matches!(state, State::State5 { .. }) } // TODO: use macro or generics pub fn is_state3(state: &State) -> bool { - match state { - State::State3 { .. } => true, - _ => false, - } + matches!(state, State::State3 { .. }) } #[derive(Debug)] diff --git a/xmr-btc/tests/e2e.rs b/xmr-btc/tests/e2e.rs index 6693ce00..c9c7f519 100644 --- a/xmr-btc/tests/e2e.rs +++ b/xmr-btc/tests/e2e.rs @@ -124,7 +124,7 @@ pub async fn init_test<'a>( xmr_amount, RELATIVE_REFUND_TIMELOCK, RELATIVE_PUNISH_TIMELOCK, - refund_address.clone(), + refund_address, ); let initial_balances = InitialBalances { alice_xmr: alice_initial_xmr_balance,