Skip to content

Commit

Permalink
test(dht): clean up test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-wright committed Aug 18, 2023
1 parent 5337963 commit 4cb60e9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/dht/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ mod tests {
fn get_random_key() -> TableKey {
let mut rng = rand::thread_rng();
let mut array = [0; 32];
#[allow(clippy::needless_range_loop)]
for i in 0..array.len() {
array[i] = rng.gen_range(0..255);
for byte in array.iter_mut() {
*byte = rng.gen_range(0..255);
}
array
}
Expand All @@ -231,16 +230,15 @@ mod tests {
or_mask.push(0u8);
leading_zeros += 8;
} else {
let x = -1_i8;
let byte = (x as u8) >> (k - leading_zeros);
let byte = 255_u8 >> (k - leading_zeros);
and_mask.push(byte);
let byte = 128_u8 >> (k - leading_zeros);
or_mask.push(byte);
leading_zeros += k - leading_zeros;
}
}
while and_mask.len() < 32 {
and_mask.push(-1i8 as u8);
and_mask.push(255_u8);
or_mask.push(0_u8);
}

Expand Down

0 comments on commit 4cb60e9

Please sign in to comment.