Skip to content

Commit

Permalink
Remove unused variable in sequencer
Browse files Browse the repository at this point in the history
For fixed size arrays just use remaining for size 1
  • Loading branch information
sorokya committed Oct 13, 2024
1 parent 7d1127c commit a0fc2a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,10 +1399,14 @@ fn generate_inner_array_deserialize(
length
));
} else if let Some(size) = get_fixed_type_size(&array.data_type, structs, enums) {
code.push_str(&format!(
" let num_items = reader.remaining() / {};\n",
size
));
if size == 1 {
code.push_str(" let num_items = reader.remaining();\n");
} else {
code.push_str(&format!(
" let num_items = reader.remaining() / {};\n",
size
));
}
code.push_str(" for _ in 0..num_items {\n");
} else {
code.push_str(" while reader.remaining() > 0 {\n");
Expand Down
3 changes: 1 addition & 2 deletions src/packet/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ impl Sequencer {
/// returns the next sequence value
pub fn next_sequence(&mut self) -> i32 {
self.counter = (self.counter + 1) % 10;
let result = self.start + self.counter;
result
self.start + self.counter
}

/// sets a new starting value for the sequencer
Expand Down

0 comments on commit a0fc2a7

Please sign in to comment.