Skip to content

Commit 85aad85

Browse files
aeyakovenkoclaude
andcommitted
v12.19 pass 9: clean up dead bindings flagged by the compiler
- set_pnl/consume_released_pnl: drop unused new_rel binding, replace with explicit underscored discard on the validation-only subtraction. - enqueue_adl A-truncation: rename a_trunc_rem → _a_trunc_rem (the remainder is unused; we consume only a_candidate_u256). - account_equity_trade_open_raw: idx arg is unused at present; name it _idx to silence the warning until either a caller uses it or we drop it from the signature. - I256::checked_add_i256: the unsigned-overflow flags from the component overflowing_add calls are unused; the sign-based overflow detection below doesn't need them. Renamed to _overflow1/_overflow2. Zero `warning: unused variable` in `cargo build --features test` now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f248d80 commit 85aad85

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/percolator.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,9 @@ impl RiskEngine {
17491749
if x > old_rel { return Err(RiskError::CorruptState); }
17501750

17511751
let new_pos = old_pos.checked_sub(x).ok_or(RiskError::CorruptState)?;
1752-
let new_rel = old_rel.checked_sub(x).ok_or(RiskError::CorruptState)?;
1752+
// Validation-only subtraction; result unused (new_rel would equal
1753+
// old_rel - x >= 0 given the `x > old_rel` guard above).
1754+
let _ = old_rel.checked_sub(x).ok_or(RiskError::CorruptState)?;
17531755
if new_pos < old_r { return Err(RiskError::CorruptState); }
17541756

17551757
// Update pnl_pos_tot
@@ -2849,7 +2851,7 @@ impl RiskEngine {
28492851
let a_old_u256 = U256::from_u128(a_old);
28502852
let oi_post_u256 = U256::from_u128(oi_post);
28512853
let oi_u256 = U256::from_u128(oi);
2852-
let (a_candidate_u256, a_trunc_rem) = mul_div_floor_u256_with_rem(
2854+
let (a_candidate_u256, _a_trunc_rem) = mul_div_floor_u256_with_rem(
28532855
a_old_u256,
28542856
oi_post_u256,
28552857
oi_u256,
@@ -3277,7 +3279,7 @@ impl RiskEngine {
32773279
/// `candidate_trade_pnl` is the signed execution-slippage PnL for this account
32783280
/// from the candidate trade under evaluation.
32793281
pub fn account_equity_trade_open_raw(
3280-
&self, account: &Account, idx: usize, candidate_trade_pnl: i128
3282+
&self, account: &Account, _idx: usize, candidate_trade_pnl: i128
32813283
) -> i128 {
32823284
let trade_gain = if candidate_trade_pnl > 0 { candidate_trade_pnl as u128 } else { 0u128 };
32833285

src/wide_math.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,11 @@ impl I256 {
870870
let r_lo = rhs.lo_u128();
871871
let r_hi = rhs.hi_u128();
872872
let (lo, carry) = s_lo.overflowing_add(r_lo);
873-
let (hi, overflow1) = s_hi.overflowing_add(r_hi);
874-
let (hi, overflow2) = hi.overflowing_add(if carry { 1 } else { 0 });
873+
// overflow bits unused — this is a wrapping-add for signed I256; the
874+
// sign-based overflow detection below uses the result, not the
875+
// unsigned-overflow flags.
876+
let (hi, _overflow1) = s_hi.overflowing_add(r_hi);
877+
let (hi, _overflow2) = hi.overflowing_add(if carry { 1 } else { 0 });
875878
let result = I256::from_lo_hi(lo, hi);
876879

877880
let self_neg = self.is_negative();

0 commit comments

Comments
 (0)