From a55bac910c3ed1547bb6621ace5e0e62db719d10 Mon Sep 17 00:00:00 2001 From: amv-dev Date: Sun, 28 Mar 2021 10:45:02 +0500 Subject: [PATCH] fix: clippy warnings --- src/core/action.rs | 2 +- src/core/indicator/result.rs | 3 ++- src/methods/collapse_timeframe.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/action.rs b/src/core/action.rs index 15229f7..4776ee3 100644 --- a/src/core/action.rs +++ b/src/core/action.rs @@ -235,7 +235,7 @@ impl From for Option { } } -impl + Copy> From<&T> for Action { +impl + Copy> From<&T> for Action { fn from(value: &T) -> Self { (*value).into() } diff --git a/src/core/indicator/result.rs b/src/core/indicator/result.rs index 2161e13..9ff7ff5 100644 --- a/src/core/indicator/result.rs +++ b/src/core/indicator/result.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; /// `Indicator` may return up to 4 signals and 4 raw values at each step #[derive(Clone, Copy)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[allow(clippy::use_self)] pub struct IndicatorResult { signals: [Action; IndicatorResult::SIZE], values: [ValueType; IndicatorResult::SIZE], @@ -93,8 +94,8 @@ impl IndicatorResult { let length = (values_length as u8, signals_length as u8); Self { - values, signals, + values, length, } } diff --git a/src/methods/collapse_timeframe.rs b/src/methods/collapse_timeframe.rs index d2347f1..8b2e7f0 100644 --- a/src/methods/collapse_timeframe.rs +++ b/src/methods/collapse_timeframe.rs @@ -109,7 +109,7 @@ mod tests { for length in 2..10 { let mut method = TestingMethod::new(length, &candles[0]).unwrap(); - let converted = candles.iter().map(|x| method.next(x)).filter_map(|x| x); + let converted = candles.iter().flat_map(|x| method.next(x)); candles .windows(length)