From a72f2645d0be7495d634898cce9f647f0c339e2f Mon Sep 17 00:00:00 2001 From: fdiniello Date: Sat, 16 Sep 2023 14:21:57 +0200 Subject: [PATCH] suggestions by Clippy --- kairo-common/src/unit_conversion.rs | 4 ++++ xyz-engine/src/position_solver.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kairo-common/src/unit_conversion.rs b/kairo-common/src/unit_conversion.rs index 777ceda..94a7c77 100644 --- a/kairo-common/src/unit_conversion.rs +++ b/kairo-common/src/unit_conversion.rs @@ -10,15 +10,19 @@ pub trait UnitsConversion { } impl UnitsConversion for f64 { + #[allow(non_snake_case)] fn dBm_to_W(&self) -> f64 { 10.0_f64.powf((self - 30.0) / 10.0) } + #[allow(non_snake_case)] fn W_to_dBm(&self) -> f64 { 30.0 + 10.0 * f64::log10(*self) } + #[allow(non_snake_case)] fn from_dB(&self) -> f64 { 10.0_f64.powf((*self) / 10.0) } + #[allow(non_snake_case)] fn to_dB(&self) -> f64 { 10.0 * f64::log10(*self) } diff --git a/xyz-engine/src/position_solver.rs b/xyz-engine/src/position_solver.rs index e0b19b7..f014bec 100644 --- a/xyz-engine/src/position_solver.rs +++ b/xyz-engine/src/position_solver.rs @@ -95,7 +95,7 @@ pub async fn solve_for(device_id: MAC) -> Result { fn trilat(a: &KnownDistance, b: &KnownDistance, c: &KnownDistance) -> Option { #![allow(non_snake_case)] - let points = vec![a.point, b.point, c.point]; + let points = [a.point, b.point, c.point]; for &p in points.iter() { if !p.is_valid() { return None;