Skip to content

Commit

Permalink
[nit] Move cnt definition to the branch it's used in. (#1683)
Browse files Browse the repository at this point in the history
It's not a big deal and compiler should be able to do this automatically, but this also reduces the scope of the definition.
  • Loading branch information
ttsugriy authored Oct 21, 2023
1 parent ff8cc9e commit 3c2b2e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bits/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ where
if count == 0 {
Ok(((input, bit_offset), 0u8.into()))
} else {
let cnt = (count + bit_offset).div(8);
if input.input_len() * 8 < count + bit_offset {
Err(Err::Error(E::from_error_kind(
(input, bit_offset),
ErrorKind::Eof,
)))
} else {
let cnt = (count + bit_offset).div(8);
let mut acc: O = 0_u8.into();
let mut offset: usize = bit_offset;
let mut remaining: usize = count;
Expand Down

0 comments on commit 3c2b2e1

Please sign in to comment.