From 2ef60874b914acec9adfb3d3070da5e57c0bdbce Mon Sep 17 00:00:00 2001 From: kingchenc Date: Sat, 13 Jun 2026 23:35:29 +0200 Subject: [PATCH] fix(examples): satisfy clippy -D warnings in gen_golden (#291) Replace `i as i64` with `i64::try_from(i)` (cast_possible_wrap) and rename the OHLCV destructure to descriptive names (many_single_char_names) so `cargo clippy --all-targets --all-features -- -D warnings` passes on the 1.95 toolchain. Dev-tool only; no library change. --- examples/rust/src/bin/gen_golden.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/rust/src/bin/gen_golden.rs b/examples/rust/src/bin/gen_golden.rs index ccfb2b65..04b45b2e 100644 --- a/examples/rust/src/bin/gen_golden.rs +++ b/examples/rust/src/bin/gen_golden.rs @@ -56,8 +56,16 @@ fn main() { let candles: Vec = (0..N) .map(|i| { - let (o, h, l, c, v) = bar(i); - Candle::new(o, h, l, c, v, i as i64).expect("valid candle") + let (open, high, low, close, volume) = bar(i); + Candle::new( + open, + high, + low, + close, + volume, + i64::try_from(i).expect("golden row index fits i64"), + ) + .expect("valid candle") }) .collect(); let closes: Vec = candles.iter().map(|c| c.close).collect();