fix(core): use f64::midpoint and stable %2 to satisfy newer toolchains
Two unrelated newer-toolchain breakages bundled because they hit on the same CI run and have the same shape (newer Rust got stricter about patterns we used): 1. clippy 1.95 added the manual_midpoint lint which fires on every instance of (a + b) / 2.0 with a help suggesting f64::midpoint. CI runs with -D warnings so it became a hard error. Twelve sites were affected — three real call sites in src/ohlcv.rs (median_price), src/indicators/donchian.rs (DonchianOutput.middle), src/indicators/ease_of_movement.rs (mid), and src/indicators/super_trend.rs (hl2); plus eight test-helper Candle::new constructions across accelerator_oscillator, atr_trailing_stop, chaikin_volatility, chandelier_exit, chande_kroll_stop, choppiness_index, super_trend, true_range. All twelve switched to f64::midpoint (stable since Rust 1.85, our workspace MSRV). 2. usize::is_multiple_of is still unstable (rust-lang/rust#128101) and only stabilizes in Rust 1.87, but the MSRV CI job uses 1.85. The two call sites in bollinger.rs and sma.rs (added with the R7 periodic-reseed tests) switched back to i % 2 == 0.
This commit is contained in:
@@ -110,7 +110,7 @@ impl Candle {
|
||||
/// The mid price `(high + low) / 2`.
|
||||
#[inline]
|
||||
pub fn median_price(&self) -> f64 {
|
||||
(self.high + self.low) / 2.0
|
||||
f64::midpoint(self.high, self.low)
|
||||
}
|
||||
|
||||
/// The weighted close `(high + low + 2*close) / 4`.
|
||||
|
||||
Reference in New Issue
Block a user