Skip to content

Commit

Permalink
refactor: use for instead of while when encoding suites
Browse files Browse the repository at this point in the history
  • Loading branch information
geonnave committed Oct 4, 2023
1 parent 4efb16f commit 4b70cd5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/src/edhoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,7 @@ fn encode_message_1(
// several suites, will be encoded as an array
output.content[1] = CBOR_MAJOR_ARRAY + (suites_len as u8);
raw_suites_len += 1;
let mut i: usize = 0;
while i < suites_len {
for i in 0..suites_len {
if suites[i] <= CBOR_UINT_1BYTE {
output.content[1 + raw_suites_len] = suites[i];
raw_suites_len += 1;
Expand All @@ -946,8 +945,7 @@ fn encode_message_1(
output.content[2 + raw_suites_len] = suites[i];
raw_suites_len += 2;
}
i += 1;
}
}
};

output.content[1 + raw_suites_len] = CBOR_BYTE_STRING; // CBOR byte string magic number
Expand Down

0 comments on commit 4b70cd5

Please sign in to comment.