From 9804625ff44516e86a6d2ae6f31d0225af5d32ae Mon Sep 17 00:00:00 2001 From: Mike Walters Date: Mon, 17 Jun 2024 13:15:42 +0100 Subject: [PATCH] Clippy fixes --- src/csv.rs | 5 +++-- src/draw.rs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/csv.rs b/src/csv.rs index 3d2742e..f2d297a 100644 --- a/src/csv.rs +++ b/src/csv.rs @@ -23,6 +23,7 @@ pub struct Record { pub freq_low: u64, pub freq_high: u64, pub freq_step: f32, + #[allow(dead_code)] pub num_samples: u32, pub samples: Vec, } @@ -56,7 +57,7 @@ pub fn load_records(input_path: &str) -> Result .trim(csv::Trim::All) .from_reader(input); - let mut rc = RecordCollection{ freq_low: std::u64::MAX, ..Default::default() }; + let mut rc = RecordCollection{ freq_low: u64::MAX, ..Default::default() }; // Loop through all lines & parse records // also keep track of frequency range & unique timestamps to determine final image size @@ -72,7 +73,7 @@ pub fn load_records(input_path: &str) -> Result rc.freq_low = std::cmp::min(rc.freq_low, record.freq_low); rc.freq_high = std::cmp::max(rc.freq_high, record.freq_high); if let Some(s) = step { - if (s - record.freq_step).abs() > std::f32::EPSILON { + if (s - record.freq_step).abs() > f32::EPSILON { return Err("Frequency step must be constant".into()); } } else { diff --git a/src/draw.rs b/src/draw.rs index e665235..a17f5f3 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -26,9 +26,9 @@ pub fn colormaps() -> HashMap<&'static str, Gradient> { } fn build_lut(colormap: &Gradient) -> Vec { - let mut lut = Vec::with_capacity(std::u16::MAX as usize + 1); - for i in 0..std::u16::MAX as usize + 1 { - let value = colormap.eval_continuous(i as f64 / std::u16::MAX as f64); + let mut lut = Vec::with_capacity(u16::MAX as usize + 1); + for i in 0..u16::MAX as usize + 1 { + let value = colormap.eval_continuous(i as f64 / u16::MAX as f64); lut.push(plotters::style::RGBColor(value.r, value.g, value.b)); } lut