Skip to content

Commit a0dc03d

Browse files
committed
f Drop res and associated returns in a few places
1 parent e11670d commit a0dc03d

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed

lightning-liquidity/src/lsps2/service.rs

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl OutboundJITChannelState {
142142
&mut self, opening_fee_params: &LSPS2OpeningFeeParams, payment_size_msat: &Option<u64>,
143143
htlc: InterceptedHTLC,
144144
) -> Result<Option<HTLCInterceptedAction>, ChannelStateError> {
145-
let res = match self {
145+
match self {
146146
OutboundJITChannelState::PendingInitialPayment { payment_queue } => {
147147
let (total_expected_outbound_amount_msat, num_htlcs) = payment_queue.add_htlc(htlc);
148148

@@ -205,9 +205,9 @@ impl OutboundJITChannelState {
205205
};
206206
Ok(None)
207207
} else {
208-
return Err(ChannelStateError(
208+
Err(ChannelStateError(
209209
"Intercepted HTLC is too small to pay opening fee".to_string(),
210-
));
210+
))
211211
}
212212
}
213213
},
@@ -268,14 +268,13 @@ impl OutboundJITChannelState {
268268
*self = OutboundJITChannelState::PaymentForwarded { channel_id: *channel_id };
269269
Ok(Some(forward))
270270
},
271-
};
272-
res
271+
}
273272
}
274273

275274
fn channel_ready(
276275
&mut self, channel_id: ChannelId,
277276
) -> Result<ForwardPaymentAction, ChannelStateError> {
278-
let res = match self {
277+
match self {
279278
OutboundJITChannelState::PendingChannelOpen { payment_queue, opening_fee_msat } => {
280279
if let Some((_payment_hash, htlcs)) =
281280
payment_queue.pop_greater_than_msat(*opening_fee_msat)
@@ -297,18 +296,15 @@ impl OutboundJITChannelState {
297296
));
298297
}
299298
},
300-
state => {
301-
return Err(ChannelStateError(format!(
302-
"Channel ready received when JIT Channel was in state: {:?}",
303-
state
304-
)))
305-
},
306-
};
307-
res
299+
state => Err(ChannelStateError(format!(
300+
"Channel ready received when JIT Channel was in state: {:?}",
301+
state
302+
))),
303+
}
308304
}
309305

310306
fn htlc_handling_failed(&mut self) -> Result<Option<ForwardPaymentAction>, ChannelStateError> {
311-
let res = match self {
307+
match self {
312308
OutboundJITChannelState::PendingPaymentForward {
313309
payment_queue,
314310
opening_fee_msat,
@@ -352,18 +348,15 @@ impl OutboundJITChannelState {
352348
*self = OutboundJITChannelState::PaymentForwarded { channel_id: *channel_id };
353349
Ok(None)
354350
},
355-
state => {
356-
return Err(ChannelStateError(format!(
357-
"HTLC handling failed when JIT Channel was in state: {:?}",
358-
state
359-
)))
360-
},
361-
};
362-
res
351+
state => Err(ChannelStateError(format!(
352+
"HTLC handling failed when JIT Channel was in state: {:?}",
353+
state
354+
))),
355+
}
363356
}
364357

365358
fn payment_forwarded(&mut self) -> Result<Option<ForwardHTLCsAction>, ChannelStateError> {
366-
let res = match self {
359+
match self {
367360
OutboundJITChannelState::PendingPaymentForward {
368361
payment_queue, channel_id, ..
369362
} => {
@@ -376,14 +369,11 @@ impl OutboundJITChannelState {
376369
*self = OutboundJITChannelState::PaymentForwarded { channel_id: *channel_id };
377370
Ok(None)
378371
},
379-
state => {
380-
return Err(ChannelStateError(format!(
381-
"Payment forwarded when JIT Channel was in state: {:?}",
382-
state
383-
)))
384-
},
385-
};
386-
res
372+
state => Err(ChannelStateError(format!(
373+
"Payment forwarded when JIT Channel was in state: {:?}",
374+
state
375+
))),
376+
}
387377
}
388378
}
389379

0 commit comments

Comments
 (0)