Skip to content

Commit

Permalink
Add TODO avoid assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Apr 10, 2019
1 parent 73c0284 commit 0011308
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/codec/rtu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ fn decode<F>(
where
F: Fn(&BytesMut) -> Result<Option<usize>>,
{
// TODO: Transform this loop into idiomatic code
loop {
let mut retry = false;
let res = get_pdu_len(buf)
.and_then(|pdu_len| {
retry = false;
debug_assert!(!retry);
if let Some(pdu_len) = pdu_len {
frame_decoder.decode(buf, pdu_len)
} else {
Expand Down

0 comments on commit 0011308

Please sign in to comment.