Skip to content

Commit

Permalink
Remove allow(dead_code)
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Apr 9, 2021
1 parent 5f4f9e7 commit 861ece8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/tests/loadnext/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ impl Random for CommandType {
const SINGLE_TX_CHANCE: f32 = 0.7;
const BATCH_CHANCE: f32 = 0.3;
// We don't generate API requests at the moment.
#[allow(dead_code)] // I't used to count total chance.
const API_REQUEST_CHANCE: f32 = 0.0;
const _API_REQUEST_CHANCE: f32 = 0.0;

#[allow(dead_code)] // I't used in the const assertion.
const CHANCES_SUM: f32 = SINGLE_TX_CHANCE + BATCH_CHANCE + API_REQUEST_CHANCE;
const _CHANCES_SUM: f32 = SINGLE_TX_CHANCE + BATCH_CHANCE + _API_REQUEST_CHANCE;
// Unfortunately. f64::abs()` is not yet a `const` function.
const_assert!(
-f32::EPSILON <= (CHANCES_SUM - 1.0f32) && (CHANCES_SUM - 1.0f32) <= f32::EPSILON
-f32::EPSILON <= (_CHANCES_SUM - 1.0f32) && (_CHANCES_SUM - 1.0f32) <= f32::EPSILON
);
let chance = rng.gen_range(0.0f32, 1.0f32);

Expand Down

0 comments on commit 861ece8

Please sign in to comment.